Hi!
I'm Matthias and I'm about starting to use the Fusion API to script some simple reoccurring tasks. Sorry for some 'stupid' questions but I didn't find any solution on the web.
What I try is to make a user selection of an existing rectangle in a sketch. With this rectangle I will do some further processing. What I wrote is:
ui = app.userInterface selectedItem1 = ui.selectEntity("Select the rectangle", "SketchCurves")
Since the filter for selectEntity doesn't have an entry like 'SketchRectangle' I used SketchCurves instead, but with this filter I can only select one line of the rectangle and not the whole rectangle.
Any help would be really appreciate. By the way: is there a good link which shows some example code how to use user selection with the API?
Many thanks in progress!
Matthias
Solved! Go to Solution.
Solved by liujac. Go to Solution.
Hi,
UserInterface.selectEntity only can select one entity. Sketch Rectangle is not a type of entity, it is a set of sketch lines. You might want to select the closed area of the Sketch Rectangle. The closed area is a profile.
selectedItem1 = ui.selectEntity("Select the profle", "Profiles")
If you did want to select sketch lines of the sketch rectangle, you need to find the connected curves and add them to active selections.
selectedItem1 = ui.selectEntity("Select the rectangle", "SketchCurves") skCurve = adsk.fusion.SketchCurve.cast(selectedItem1.entity) sketch = skCurve.parentSketch curves = sketch.findConnectedCurves(skCurve) for curve in curves: ui.activeSelections.add(curve)
Regards,
Jack
Hi Jack,
thanks for the answer. I will go with the 'profile' selection type.
Matthias