Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Pick cylindrical axis like mate constraint

1 REPLY 1
Reply
Message 1 of 2
Anonymous
352 Views, 1 Reply

Pick cylindrical axis like mate constraint

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!

1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

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))"

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report