Message 1 of 2
Editing sketches in parts while in assembly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
So I'm trying to edit a 3D spline in 3D sketch from a part while in assembly context.
The problem is when I select some geometry from other occurrences that I want to use to align my 3D spline, there is no kind conversion between the assembly coordinate system and the part's one. I end up with a displacement equal to displacement between the assembly and part coordinate systems.
I hope I explain this good enough 🙂
Here is my code:
Sub Flexible2() Dim oDoc As AssemblyDocument Set oDoc = ThisApplication.ActiveDocument Dim OriginAssy As WorkPoint Set OriginAssy = oDoc.ComponentDefinition.WorkPoints.Item(1) Dim oTG As TransientGeometry Set oTG = ThisApplication.TransientGeometry Dim oPart As ComponentOccurrence Dim partDoc As Document Set oPart = ThisApplication.CommandManager.Pick(kAssemblyLeafOccurrenceFilter, "Pick a part") Set partDoc = oPart.Definition.Document Dim oPartDef As PartComponentDefinition Set oPartDef = partDoc.ComponentDefinition Dim oSketch3D As Sketch3D Set oSketch3D = oPart.Definition.Sketches3D.Item(1) Dim oSketch3D2 As Sketch3DProxy Call oPart.CreateGeometryProxy(oSketch3D, oSketch3D2) Dim oPointCoords As ObjectCollection Set oPointCoords = ThisApplication.TransientObjects.CreateObjectCollection() Dim oEdge As EdgeProxy Set oEdge = ThisApplication.CommandManager.Pick(kPartEdgeCircularFilter, "Pick the first circular edge") Dim oEdge2 As EdgeProxy Set oEdge2 = ThisApplication.CommandManager.Pick(kPartEdgeCircularFilter, "Pick the second circular edge") Dim Point1 As Point Set Point1 = oEdge.Geometry.Center Dim Point2 As SketchPoint3D Set Point2 = oSketch3D2.SketchPoints3D.Add(Point1) Dim Point3 As Point Set Point3 = oEdge2.Geometry.Center Dim Point4 As SketchPoint3D Set Point4 = oSketch3D2.SketchPoints3D.Add(Point3) Dim SketchLine As SketchLine3D Set SketchLine = oSketch3D.SketchLines3D.Item(2) Call SketchLine.EndSketchPoint.ConnectTo(Point4) Dim SketchPath As SketchSpline3D Set SketchPath = oSketch3D.SketchSplines3D.Item(1) Call SketchPath.EndSketchPoint.ConnectTo(Point2) End Sub
Here is an example of what happens:
Any idea how I can fix this?
Autodesk Inventor 2015 Certified Professional