
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to write a script to create a patch loft between a closed edge on a solid to a sketched circle profile (both highlighted in blue). The solid is a sweep feature obtained from a square profile swept through a closed spline curve.
My first problem is that I do not know how to convert the closed BRep edge on the solid to a profile object type. I tried to use the following lines of code to create profile:
brep_edges = rootComp.bRepBodies[0].edges
profile0 = brep_edges[4]
But when I tried to loft, I got the following error message:
RuntimeError 3: Invalid entity type: entities the BRepFace, Profile, Path, SketchPoint, ConstructionPoint, or an ObjectCollection containing a contiguous set of Profile objects that defines the section.
So I went into debug mode, it shows that the object type for profile0 is fusion.BRepEdge. So I thought need to convert that BRep edge into a profile. So I tried to use the following lines of code:
brep_edges = rootComp.bRepBodies[0].edges
profile0 = rootComp.createBRepEdgeProfile(brep_edges[4])
This time in debug mode, it shows that profile0 is a fusion.Profile object type. But when I tried to loft between profile0 and profile1 (which is a circle on a sketch), I received the following error message:
TypeError: LoftSections_add() takes exactly 2 arguments(1 given)
So I used profile0.isValid to check whether the profile is valid, but was returned with False. It seems that I managed to create a Profile from a BRep edge, but the profile is not valid. I don't know where went wrong.
My second problem is I do not know how to identify my desired edge on that solid. Is there ways to differentiate these edges automatically without user interaction?
Many thanks in advance.
Solved! Go to Solution.