- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am having a strange problem where ui.messageBox() is actually causing my script to function correctly. And without it the script is broken.
I am importing in meshbodies and building a bounding box around them. Then I copy the bounding box and move it around each occurrence in the project. At each interval of movement I check to see if the copied bounding box is intersecting with any other bounding box in the project (excluding the mesh that was just imported), and if it is, I keep moving the part around each occurrence until it can find a spot. Image shows the path of the part around an occurrence.
This is working great. However the problem happens when I try to use this function in a loop and import 2 projects in one after another. When I do this, the first part imports fine, but when the second part uses the Intersection checker, it is not registering intersection with the first imported part. The strange thing is that when I use ui.messageBox() to display the result of the intersection check, the 2nd part imports correctly. I tried to use a sleep() in my program but that is not the issue. Any ideas?
expected result:
current result: (importing on top of 1st part)
def isIntersecting(selectionBBox:adsk.core.BoundingBox3D):
product = app.activeProduct
design = adsk.fusion.Design.cast(product)
root = design.rootComponent
occCount = root.occurrences.count
for i in range(occCount-1):
occ = root.occurrences.item(i)
occBBox = occ.boundingBox
if occBBox.intersects(selectionBBox):
return True
return False
Solved! Go to Solution.