Hello,
In the snip I have a box (black edges) that is in the rhino scene and a brep that is in a custom display conduit and does not exist in the rhino scene.
I am using the Technical Display Mode and would like my conduit object to get the edges to match the brep that is in the scene/3d space.
-Do I specifically need to draw the brep wires and add those curves/edges to my conduit?
-Is it a display mode setting I need to change? Nothing worked when I tried this…
-Display attribute setting needed?
My attributes:
@staticmethod
def Geometry():
attr = Display.PreviewAttributes()
attr.CurveColor = System.Drawing.Color.Black #Utils.ParseHexColor(UI.drawing_colors.get("new"), 255)
attr.CurveThickness = 2
attr.ObjectColor = System.Drawing.Color.White #Utils.ParseHexColor(UI.drawing_colors.get("new"), 200)
attr.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject
attr.TextColor = Color.White
attr.CustomGroundPlaneShadowOnly = True
# attr.ClippingEdgeColor = Color.Magenta
# attr.ClippingEdgeThickness = 10
attr.Material.Diffuse = Color.WhiteSmoke
attr.Material.Transparency = 0.0
# attr.CullBackfaces = True
# attr.CastShadows = True
# attr.AmbientLightingColor = System.Drawing.Color.Red
# attr.IgnoreHighlights = True
return attr
my PostDrawObjects:
def PostDrawObjects(self, e):
try:
# print(f"Model DrawForeground: self._objects: {self._objects}")
"""Draw objects with either standard shading or custom shader."""
# Ensure the event corresponds to the intended viewport
if self._target_viewport_id and e.Viewport.Id != self._target_viewport_id:
return # Skip drawing in other viewports
utils = Utils()
e.Display.DisplayPipelineAttributes.ShadowsOn = True
e.Display.EnableDepthTesting(True) # Disable Depth Testing so that the next elements that get drawn to through everything
# e.Display.EnableClippingPlanes(True) # This doesn't seem to do anything? Perhaps only works on init?
# e.Display.AddClippingPlane(Rhino.Geometry.Point3d(0, 0, 4.5), -Rhino.Geometry.Vector3d.ZAxis) # Add clipping plane to conduit
self._exploded_geometries.clear()
all_meshes = [] # Create a list to store all the render meshes in for this drawforeground method
for obj, attr in self._objects.items():
# print(f"self._objects: obj: {obj}, attr: {attr}")
color = attr.CurveColor
material = attr.Material
mat_color = attr.ObjectColor
if attr.ColorSource == Rhino.DocObjects.ObjectColorSource.ColorFromLayer:
layer = scriptcontext.doc.Layers[attr.LayerIndex]
color = layer.Color
if isinstance(obj, Rhino.Geometry.Brep):
print("post draw brep")
e.Display.DrawBrepShaded(obj, material)
e.Display.DrawBrepWires(obj, attr.CurveColor, -1)
This successfully draws my objects with shadows or not depending on which display mode I have of course.. but I cannot seem to get the brep edge wires to show up…
Thanks for your help!