Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello guys,
I want to make a code that "detects" a named face and create a sketch on that face.
I have a code, but i have to click the face to create a sketch.
The code:
oAssDoc = ThisApplication.ActiveDocument oAssDef = oAssDoc.ComponentDefinition Dim oFace As Face oFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select a Face ") 'make sure it is a planar face If oFace.SurfaceType = SurfaceTypeEnum.kPlaneSurface Then oPlanarSurface = oFace.Geometry 'add a sketch oSketch = oAssDef.Sketches.Add(oFace) 'trying to choose an appropriate point 'assume this planar face has one edge loop only oEdgeLoop = oFace.EdgeLoops(1) oMinPt = oEdgeLoop.RangeBox.MinPoint oMaxPt = oEdgeLoop.RangeBox.MaxPoint CenterPt = ThisApplication.TransientGeometry.CreatePoint((oMaxPt.X + oMinPt.X) / 2#, (oMaxPt.Y + oMinPt.Y) / 2#, (oMaxPt.Z + oMinPt.Z) / 2#) Else End If
Is it possible to detect the ‘face0’ in the named geometry(without extra clicking) and create a sketch on that face?
Help is much appreciated 🙂
Solved! Go to Solution.