iLogic Mating a Component to Assembly Workplane

iLogic Mating a Component to Assembly Workplane

felix.cortes5K3Y2
Advocate Advocate
799 Views
2 Replies
Message 1 of 3

iLogic Mating a Component to Assembly Workplane

felix.cortes5K3Y2
Advocate
Advocate

Hey forum,

 

I am trying to constrain a part to an assembly relative to a work plane on the assembly using the API but I cannot manage to do it. I need to mate a part with a plane to an assembly plane. I know there is a sample on the programming/API section but that's to mate to another part, which is not what I am trying to do


Here's what I have written so far:

 

Dim oAsm As AssemblyDocument = ThisApplication.ActiveDocumento
Dim oAsmComp As AssemblyComponentDefinition = oAsm.ComponentDefinition
Dim oOcc As ComponentOccurrence = oAsmComp.Occurrences.Item(1)
Dim oPC As PartComponentDefinition = oOcc.Definition

Dim oWP As WorkPlane = oPC.WorkPlanes.Item(3)
Dim oWPProxy As WorkPlaneProxy
	oOcc.CreateGeometryProxy(oWP, oWPProxy)
	
Dim oAsmWP As WorkPlane
'''???? confused here
''' I think i need to make a proxy for this oAsmWP
''' Just not sure since CreateGeometryProxy is a class from oOcc

oAsmComp.Constraints.AddFlushConstraint(oWPProxy, oAsmWP, "")
	

 

Thanks!

Felix

0 Likes
Accepted solutions (1)
800 Views
2 Replies
Replies (2)
Message 2 of 3

bhavik4244
Collaborator
Collaborator
0 Likes
Message 3 of 3

dutt.thakar
Collaborator
Collaborator
Accepted solution

@felix.cortes5K3Y2 

 

First of all, You dont need to create a proxy if you are using planes or any work entities from assembly itself, the proxy is required only if you are using something with occurrences.

 

 

Try this rule and see if this helps.

 

Dim oAsm As AssemblyDocument = ThisApplication.ActiveDocument
Dim oAsmComp As AssemblyComponentDefinition = oAsm.ComponentDefinition
Dim oOcc As ComponentOccurrence = oAsmComp.Occurrences.Item(1)
Dim oDC As PartDocument = oOcc.Definition.Document
Dim oPC As PartComponentDefinition = oDC.ComponentDefinition

Dim oWP As WorkPlane = oPC.WorkPlanes.Item(3)
Dim oWPProxy As WorkPlaneProxy
	oOcc.CreateGeometryProxy(oWP, oWPProxy)
	
Dim oAsmWP As WorkPlane = oAsmComp.WorkPlanes.Item(3) ' You have to define the workplane with which you want to constrain.
oAsmComp.Constraints.AddFlushConstraint(oAsmWP,oWPProxy,"0")

 

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes