Using sketchlines as input for a SplitBodyFeature

Using sketchlines as input for a SplitBodyFeature

0xHexdec
Contributor Contributor
658 Views
2 Replies
Message 1 of 3

Using sketchlines as input for a SplitBodyFeature

0xHexdec
Contributor
Contributor

Hey there,

currently I am trying to create a SpitBodyFeature with one or more targetbodies and a sketch as tool, but as the documentation says the SplitBodyFeatureInput takes:

- A BRepBody or a ObjectCollection of BRepBodies as target

- the splitting tool as open or solid BRepBody, construction plane, profile or face

- the isSplittingToolExtended flag

But the UI in Fusion allows to select (non-closed) sketch lines as splitting tools.

Is the UI representation converting these lines in a fancy way or am I missing something here?

I made a fast screencast if in doubt what I mean.

 

 

0 Likes
Accepted solutions (1)
659 Views
2 Replies
Replies (2)
Message 2 of 3

JesusFreke
Advocate
Advocate
Accepted solution

You might try creating the split body feature via the UI, and then inspecting it via the API, to see what it's actually using as the input. 

0 Likes
Message 3 of 3

0xHexdec
Contributor
Contributor

I already tried that, but accessing the splitBodies and splittingTool always results in an exception. While debugging, the value of these variables is always unknown (more precise: the Traceback is shown) in the Variable-View. All other values are readable and changable.

Here is a snipped of my code, I created a SelectionInput and added a "Features" selection filter in the CreateEventHandler. This code here is in the InputChangedHandler:

app = adsk.core.Application.get()
        ui = app.userInterface
        inputs = adsk.core.CommandInputs.cast(eventArgs.firingEvent.sender.commandInputs)
        design = adsk.fusion.Design.cast(app.activeProduct)
        root = design.rootComponent
        changedInput = eventArgs.input
        if changedInput.id == 'selection':
            selection = adsk.core.SelectionCommandInput.cast(inputs.itemById("selection"))
            if selection.selection(0).entity.classType() == adsk.fusion.SplitBodyFeature.classType():
                splitFeature = adsk.fusion.SplitBodyFeature.cast(selection.selection(0).entity)
                print(splitFeature.name)
                print(splitFeature.attributes)
                print(splitFeature.splittingTool.classType()) # this throws exception based on non-existance of splittingTool
                print("Ended")

And while rechecking and writing this post, I found my problem! 

To be able to read the variables, I have to roll back the Timeline before the Feature I want to check...

Thanks

 

EDIT:

The SplitBodyFeature simply can handle a SketchLine as input, would be nice to add that to the Documentation. If the SketchLine is connected to other SketchLines, they are automatically used as a single Object by passing one of the line segments to the Feature. Currently I try to understand how to use unconnected (but start and endpoint of each line touches, visually connected) SketchLines, hence this is also possible in the UI but I could not finde the difference. They look the same (meaning I found no difference till now) but do different things.

0 Likes