CAM: change design of origin axis (#20358)
* change design of CAM origin axis * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * change Inventor example comment * move to SoFCPlacementIndicatorKit - increase stock point size display * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Use So3DAnnotation for origin axis --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -127,48 +127,21 @@ class ViewProvider:
|
||||
|
||||
# Setup the axis display at the origin
|
||||
self.switch = coin.SoSwitch()
|
||||
self.sep = coin.SoSeparator()
|
||||
self.axs = coin.SoType.fromName("SoAxisCrossKit").createInstance()
|
||||
self.sep = coin.SoType.fromName("So3DAnnotation").createInstance()
|
||||
|
||||
# Adjust the axis heads if needed, the scale here is just for the head
|
||||
self.axs.set("xHead.transform", "scaleFactor 1.5 1.5 1")
|
||||
self.axs.set("yHead.transform", "scaleFactor 1.5 1.5 1")
|
||||
self.axs.set("zHead.transform", "scaleFactor 1.5 1.5 1")
|
||||
self.axs = coin.SoType.fromName("SoFCPlacementIndicatorKit").createInstance()
|
||||
self.axs.axisLength.setValue(1.2)
|
||||
|
||||
# Adjust the axis heads if needed, the scale here is just for the head
|
||||
self.axs.set("xHead.transform", "translation 50 0 0")
|
||||
self.axs.set("yHead.transform", "translation 0 50 0")
|
||||
self.axs.set("zHead.transform", "translation 0 0 50")
|
||||
# enum values for SoFCPlacementIndicatorKit
|
||||
AXES = 1
|
||||
LABELS = 4
|
||||
ARROWHEADS = 8
|
||||
|
||||
# Adjust the axis line width if needed
|
||||
self.axs.set("xAxis.transform", "scaleFactor 0.5 0.5 1")
|
||||
self.axs.set("xAxis.appearance.drawStyle", "lineWidth 9")
|
||||
self.axs.set("yAxis.transform", "scaleFactor 0.5 0.5 1")
|
||||
self.axs.set("yAxis.appearance.drawStyle", "lineWidth 9")
|
||||
self.axs.set("zAxis.transform", "scaleFactor 0.5 0.5 1")
|
||||
self.axs.set("zAxis.appearance.drawStyle", "lineWidth 9")
|
||||
self.axs.parts.setValue(AXES | LABELS | ARROWHEADS)
|
||||
|
||||
self.sca = coin.SoType.fromName("SoShapeScale").createInstance()
|
||||
self.sca.setPart("shape", self.axs)
|
||||
self.sca.scaleFactor.setValue(2) # Keep or adjust if needed
|
||||
|
||||
self.mat = coin.SoMaterial()
|
||||
# Set sphere color to bright yellow
|
||||
self.mat.diffuseColor = coin.SbColor(1, 1, 0)
|
||||
self.mat.transparency = 0.35 # Keep or adjust if needed
|
||||
|
||||
self.sph = coin.SoSphere()
|
||||
self.scs = coin.SoType.fromName("SoShapeScale").createInstance()
|
||||
self.scs.setPart("shape", self.sph)
|
||||
# Increase the scaleFactor to make the sphere larger
|
||||
self.scs.scaleFactor.setValue(20) # Adjust this value as needed
|
||||
|
||||
self.sep.addChild(self.sca)
|
||||
self.sep.addChild(self.mat)
|
||||
self.sep.addChild(self.scs)
|
||||
self.sep.addChild(self.axs)
|
||||
self.switch.addChild(self.sep)
|
||||
|
||||
self.switch.addChild(self.sep)
|
||||
vobj.RootNode.addChild(self.switch)
|
||||
self.showOriginAxis(True)
|
||||
|
||||
|
||||
@@ -341,6 +341,7 @@ def SetupStockObject(obj, stockType):
|
||||
|
||||
PathIconViewProvider.ViewProvider(obj.ViewObject, "Stock")
|
||||
obj.ViewObject.Transparency = 90
|
||||
obj.ViewObject.PointSize = 5
|
||||
obj.ViewObject.DisplayMode = "Wireframe"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user