Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hello,
could anyone help me here? i am trying to get the Global z value and use this as a base for my script. the code i have here works like i expect it to, only that it takes the local origin point where I want the global.
import adsk.core, adsk.fusion, adsk.cam, traceback
app = adsk.core.Application.get()
ui = app.userInterface
def ColorWhite(j):
j.appearance = app.favoriteAppearances.itemByName("WHITE")
def run(context):
try:
design = adsk.fusion.Design.cast(app.activeProduct)
rootComp = design.rootComponent
for i in range(0, rootComp.allOccurrences.count):
occ = rootComp.allOccurrences.item(i)
subComp = occ.component
for k in range(0, subComp.bRepBodies.count):
bodies = subComp.bRepBodies.item(k)
boundBox = bodies.boundingBox.maxPoint.z - bodies.boundingBox.minPoint.z
faces = bodies.faces
for j in faces:
if j.centroid.z < .001 or abs(j.centroid.z-boundBox) < .001:
ColorWhite(j)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Solved! Go to Solution.