Hello,
I'm doing some Assembly automation. There is an installation and I want to place a conical hopper template in the assembly.
I want to constraint two work planes of the template to the mid-axis of the destination by placing. The idea is:
1. Place template
2. Run iLogic rule
3. Select mid axis postion (the work planes are predefined)
4. Done
Problem:
I'm not able to pick the axis like mate constraint does. (attached screenshots "Aim")
CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter)
Think there is my problem, but I don't know which command picks the axis.
Code:
Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition Dim oOccFound As ComponentOccurrence '''Iterate through occurrences
For Each oOcc As ComponentOccurrence In oAsmCompDef.Occurrences If oOcc.Name = "Hopper:1" Then oOccFound = oOcc Exit For End If Next Dim oPartDef1 As PartComponentDefinition oPartDef1 = oOccFound.Definition
'''Get defined work planes Dim oPartPlane1 As WorkPlane oPartPlane1 = oPartDef1.WorkPlanes("UpperWorkPlane1") Dim oPartPlane2 As WorkPlane oPartPlane2 = oPartDef1.WorkPlanes("UpperWorkPlane2") Dim oAsmPlane1 As WorkPlaneProxy oOccFound.CreateGeometryProxy(oPartPlane1, oAsmPlane1) Dim oAsmPlane2 As WorkPlaneProxy oOccFound.CreateGeometryProxy(oPartPlane2, oAsmPlane2)
'''Select constraint reference Dim comp = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter,"Select Upper Axis:") '''Create constraint
Dim colCons As AssemblyConstraint colCons = oAsmCompDef.Constraints.AddMateConstraint(oAsmPlane1, comp, 0) colCons = oAsmCompDef.Constraints.AddMateConstraint(oAsmPlane2, comp, 0)
Running Inventor 2012
Thanks in advance!
Any ideas or is this impossible to do via iLogic? 😞
I tried to create an axis line but this cannot be chosen for constraint.
Code snippet:
Dim oFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter,"Select cylindrical Face:") Dim oCylinder As Cylinder oCylinder = oFace.Geomerty Dim oAxisLine As Line oAxisLine = ThisApplication.TransientGeomerty.CreateLine(oCylinder.BasePoint, oCylinder.AxisVector.AsVector)
And swaped "comp" with "oAxisLine" in my program.
It´s producing following error: "Not implemented (Exception from HRESULT:0x80004001 (E_NOTIMPL))"