05-18-2020, 03:39 PM
I want to create an extrusion 120mm x 40mm x 2345.56mm
i was able to build a simple cube but i cant control the length of the extrusion, extrusion vector acts oddly i can step it up 1 unit at a time but if i do big changes i see the length changing in odd lengths
private void CreateExtrudedModel()
{
Vector3D extrudeVector=new Vector3D(0,1, 0); // Length and Direction Of Extrusion
Vector3D shapeYVector3D= new Vector3D(1, 0, 0); //Extrusion Vector
Vector3D modelOffset = new Vector3D(0, 0, 0); //Offset in Coordinate Space X , Y Z
Point Point1 = new Point(0,0);
Point Point2 = new Point(0,10);
Point Point3 = new Point(10,10);
Point Point4 = new Point(10,0);
List<Point> centeredShapePositions = new List<Point>() { Point1, Point2, Point3, Point4 };
try
{
MeshGeometry3D extrudedMesh = Mesh3DFactory.CreateExtrudedMeshGeometry(centeredShapePositions,
true,
modelOffset,
extrudeVector,
shapeYVector3D,
ExtrudeTextureCoordinatesGenerationType.Cylindrical);
CreateGeometryModel(extrudedMesh);
}
catch (Exception ex)
{
MessageBox.Show("Error extruding shape:\r\n" + ex.Message);
}
}
private void CreateGeometryModel(MeshGeometry3D meshGeometry3D)
{
GeometryModel3D ShownMode = new GeometryModel3D();
ShownMode.Material = this._standardMaterial;
ShownMode.Geometry = meshGeometry3D;
ObjectsGroup.Children.Clear();
ObjectsGroup.Children.Add(ShownMode);
}
i was able to build a simple cube but i cant control the length of the extrusion, extrusion vector acts oddly i can step it up 1 unit at a time but if i do big changes i see the length changing in odd lengths
private void CreateExtrudedModel()
{
Vector3D extrudeVector=new Vector3D(0,1, 0); // Length and Direction Of Extrusion
Vector3D shapeYVector3D= new Vector3D(1, 0, 0); //Extrusion Vector
Vector3D modelOffset = new Vector3D(0, 0, 0); //Offset in Coordinate Space X , Y Z
Point Point1 = new Point(0,0);
Point Point2 = new Point(0,10);
Point Point3 = new Point(10,10);
Point Point4 = new Point(10,0);
List<Point> centeredShapePositions = new List<Point>() { Point1, Point2, Point3, Point4 };
try
{
MeshGeometry3D extrudedMesh = Mesh3DFactory.CreateExtrudedMeshGeometry(centeredShapePositions,
true,
modelOffset,
extrudeVector,
shapeYVector3D,
ExtrudeTextureCoordinatesGenerationType.Cylindrical);
CreateGeometryModel(extrudedMesh);
}
catch (Exception ex)
{
MessageBox.Show("Error extruding shape:\r\n" + ex.Message);
}
}
private void CreateGeometryModel(MeshGeometry3D meshGeometry3D)
{
GeometryModel3D ShownMode = new GeometryModel3D();
ShownMode.Material = this._standardMaterial;
ShownMode.Geometry = meshGeometry3D;
ObjectsGroup.Children.Clear();
ObjectsGroup.Children.Add(ShownMode);
}