Hello
I have made 3d model of nasal cavity ,now I want to add another segment in which I will create a plane surface with zero thickness , how can I do that?
Hello
I have made 3d model of nasal cavity ,now I want to add another segment in which I will create a plane surface with zero thickness , how can I do that?
If you want a model. You can add a modelNode to the scene and set its polydata from vtk.vtkPlaneSource()
I’m sure you’ll find vtk examples on how to use that filter and you can use this from the scriptRepository:
# Create model node and add to scene
modelsLogic = slicer.modules.models.logic()
model = modelsLogic.AddModel(sphere.GetOutput())
Instead of sphere it should be your plane.
But can I export this plane as a STL geometry , how can I do that please help
You can save the plane as a json file, which contains the plane position and normal, size, etc. You can also create a model node from the markup node using this code snippet that can be saved as STL, PLY, etc. file format:
planeNode = getNode('P')
# Get plane geometry
import numpy as np
origin = np.array(planeNode.GetOriginWorld())
axisX = np.zeros(3)
axisY = np.zeros(3)
axisZ = np.zeros(3)
planeNode.GetAxesWorld(axisX, axisY, axisZ)
corner = origin - 0.5 * size[0]*axisX - 0.5 * size[1]*axisY
size = planeNode.GetSize()
# Create polygonal mesh model that can be saved as ply, obj, stl,... file
planeSource = vtk.vtkPlaneSource()
planeSource.SetOrigin(corner)
planeSource.SetPoint1(corner+size[0]*axisX)
planeSource.SetPoint2(corner+size[1]*axisY)
planeModel = slicer.modules.models.logic().AddModel(planeSource.GetOutputPort())
Why do you need this plane as an STL file?
Where should I write the code? I am not getting any option
I need this plane because i will use this plane to select patches in my geometry for giving boundary conditions
Your can ilyen the Python console from the View menu.