Message 1 of 15
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I Need some help trying to project a face onto a sketch that has been split using the split body feature. When I run the script it projects around the whole component and not the body/face.
So the way this is suppose to work is Make a copy of body1 and then split that copied body in half using splitbody and then make a sketch on that split-body xZ plane and then project the split face(Z+ side only) onto the sketch.
The Part I am testing this on is a tube with a Through Hole in the center of it. I have attached it below.
import adsk.core, adsk.fusion, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
# Get active design
product = app.activeProduct
design = adsk.fusion.Design.cast(product)
if not design:
ui.messageBox('No active Fusion design', 'No Design')
return
# Get root component in this design
rootComp = design.rootComponent
# Get the sub component
occs = rootComp.occurrences
compA = occs.item(6).component
# Get the body in the sub component
body1 = compA.bRepBodies[0]
# Copy/paste body from sub component to sub component
compA.features.copyPasteBodies.add(body1)
# Get the second copied body
body2 = compA.bRepBodies[1]
# Create SplitBodyFeatureInput
splitBodyFeats = rootComp.features.splitBodyFeatures
splitBodyInput = splitBodyFeats.createInput(body2, compA.xZConstructionPlane, True)
# Create split body feature
splitBodyFeats.add(splitBodyInput)
# Get the second body split
body3 = compA.bRepBodies[1]
targetBody: adsk.fusion.BRepBody = body3
skt: adsk.fusion.Sketch = compA.sketches.add(
compA.xZConstructionPlane
)
skt.project(targetBody)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Solved! Go to Solution.