ilogic project part sketch into assembly sketch

ilogic project part sketch into assembly sketch

snichols
Advocate Advocate
440 Views
1 Reply
Message 1 of 2

ilogic project part sketch into assembly sketch

snichols
Advocate
Advocate

I am trying to project a sketch from a part in an assembly to an assembly sketch. I have the below code started but get an undefined error, any help would be appreciated.

 

'Get the assembly component definition
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oMatrix As Matrix = oTG.CreateMatrix
Dim oOccurrence As ComponentOccurrence

Dim compOcc1 As ComponentOccurrence = oAsmCompDef.Occurrences.ItemByName("HANDHOLE RIM - J025938:1")

' Get the X-Y work plane.'Dim SketchPlane As Inventor.WorkPlane = compOcc1.WorkPlanes.Item(2)
Dim SketchPlane As WorkPlane
SketchPlane = compOcc1.Definition.WorkPlanes("XZ Plane")

'Create the proxy planes / points / axis
Dim oproxySketchPlane As WorkPlaneProxy = Nothing
compOcc1.CreateGeometryProxy(SketchPlane, oproxySketchPlane1)

' Create a new sketch.
Dim oSketch1 As Inventor.PlanarSketch
oSketch1 = oAsmCompDef.Sketches.Add(oproxySketchPlane1, False)
oSketch1.Name = "aCutout"
'Sketch.Edit()

'Get Part sketch
Dim oSketch2 As PlanarSketch = compOcc1.Definition.Sketches("CUTOUT")

Call oSketch2.CopyContentsTo(oSketch1)
0 Likes
441 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

Also you added a 1 to the end of "oproxySketchPlane" when defining oSketch1.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes