Message 1 of 6
How to create a three point construction plane

Not applicable
09-29-2015
07:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I could not find any sample/example for creating a custom constrction plane, say, by three point method.
My code is trying to create a Sweep feature.
And the code is:
def getThicknessFaceEdge(self,edge): face1 = edge.faces[0] face2 = edge.faces[1] thicknessFace = None thicknessEdge = None if face1.evaluator.area > face2.evaluator.area: thicknessFace = face2; else: thicknessFace = face1; thicknessEdge = thicknessFace.edges.item(1) # hardcoded, but need to search for next/smaller edge, TBD return (thicknessFace, thicknessEdge); def getFaceNormal(self,face): pt = face.pointOnFace() # Some ERROR here..hmmm (returnValue, normal) = face.evaluator.getNormalAtPoint(pt) return normal; def Execute(self, selectedEdge): if not isinstance(selectedEdge,adsk.fusion.BRepEdge): return; doc = app.activeDocument d = doc.design rootComp = d.rootComponent (thkFc, thkEd) = self.getThicknessFaceEdge(selectedEdge) (returnValue, startSelEdPoint, endSelEdPoint) = selectedEdge.evaluator.getEndPoints() thckFcNormal = self.getFaceNormal(thkFc) thckFcNormal.scaleBy(4) # some hardcoded value for now TBD, Take it from UI later (returnValue, startThkEdPoint, endThkEdPoint) = thkEd.evaluator.getEndPoints() startThkNormalEndPoint = startThkEdPoint.copy startThkNormalEndPoint.trabslateBy(thckFcNormal) sketches = rootComp.sketches profileSketch = sketches.add(thkFc) profileSketch.project(thkFc) # need a construction Plane passing through startThkEdPoint, endThkEdPoint, startThkNormalEndPoint # TBD # create a new pathSketch on the constructionPlane # TBD # Create Sweep using profileSketch and the pathSketch # TBD
Please have a look at this code and suggest improvements as well.