combine intersect feature target body selection

Not applicable
07-03-2019
03:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am working on something that involves taking two selected bodies and finding and creating a new body from their intersection. I want to access this bodies properties, and then later delete it, but I am having trouble referencing the tool body that was modified during the combine feature. I have tried a few things and have gotten different results.
targetBody = selection1Copy toolBodies = adsk.core.ObjectCollection.create() toolBodies.add(selection2) combineIntersectionInput= rootComp.features.combineFeatures.createInput(targetBody, toolBodies) combineIntersectionFeatures = features.combineFeatures combineIntersectionInput = combineIntersectionFeatures.createInput(targetBody, toolBodies) combineIntersectionInput.operation = adsk.fusion.FeatureOperations.IntersectFeatureOperation combineIntersectionInput.isKeepToolBodies = True combineIntersectionFeatures.add(combineIntersectionInput) intersectionBodies = combineIntersectionFeatures.bodies intersectionBodies.deleteMe()
this gives me an error that says attribute error:bodies. I also tried this:
targetBody = selection1Copy toolBodies = adsk.core.ObjectCollection.create() toolBodies.add(selection2) combineIntersectionInput= rootComp.features.combineFeatures.createInput(targetBody, toolBodies) combineIntersectionFeatures = features.combineFeatures combineIntersectionInput = combineIntersectionFeatures.createInput(targetBody, toolBodies) combineIntersectionInput.operation = adsk.fusion.FeatureOperations.IntersectFeatureOperation combineIntersectionInput.isKeepToolBodies = True combineIntersectionFeatures.add(combineIntersectionInput) ui.messageBox('body created') targetBody.deleteMe()
I get an error saying: The target body is lost, try editing this feature to reselect target body. It appears I am going about this the wrong way or am missing something, but it is not clear to me where I am going wrong here. Any help would be appreciated.