Skip to content

CAD Modeling

64 Topics 226 Posts

Working with CAD models

  • Importing polylines from text file

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    brynB
    You would have to define the polylines in a supported file format, e.g. VTK. To create such a file from Python, you could do something like this: import vtk # define points x1,y1,z1, etc. # add the actual points points = vtk.vtkPoints() points.InsertNextPoint(x1,y1,z1) points.InsertNextPoint(x2,y2,z2) points.InsertNextPoint(x3,y3,z3) # define the lines lines = vtk.vtkCellArray() lines.InsertNextCell(3) # next line is composed of 3 vertices lines.InsertCellPoint(0) # vertex 1 lines.InsertCellPoint(1) # vertex 2 lines.InsertCellPoint(2) # vertex 3 # assemble as surface mesh mesh = vtk.vtkPolyData() mesh.SetPoints(points) mesh.SetLines(lines) # write to file, supported by Sim4Life, Paraview, etc. writer = vtk.vtkDataSetWriter() writer.SetInputData(mesh) writer.SetFileName(r"E:\temp\Foo.vtk") writer.Write()
  • Introducing the Image Modeling module: Image and LabelField

    1
    2
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • How can I export a mesh model as IGES

    4
    3 Votes
    4 Posts
    3k Views
    brynB
    @pcrespo By the way. Converting to Solid (using either method) only works well when a) the mesh resolution is not too high (else it will take forever and use huge amounts of memory) b) the surface mesh is manifold and has no self-intersections. these defects can be identified and often fixed using the Mesh Doctor ("Automatically Fix"). [image: 1525763911163-d38bb2c1-efd5-4038-b84a-605be284dda1-image.png] [image: 1525763920888-3d828313-84bb-4410-9be9-d584b6318823-image-resized.png]
  • Nearest point to a spline

    Solved python
    2
    0 Votes
    2 Posts
    1k Views
    SylvainS
    got it: wire = GetWires(spline)[0] curve = wire.GetGeometry(transform_to_model_space=True) law = curve.GetLaw() t0 = curve.MinDistParameter(point_start)