You are on page 1of 2

21/01/2017

ConstraintanAssemblyWorkplanewithaComponentOccurenceWorkplane?ManufacturingDevBlog

ManufacturingDevBlog
(http://adndevblog.typepad.com/manufacturing/)

TheresourceforsoftwaredevelopersworkingwithDesign,LifecycleandSimulationtechnologiesfromAutodesk.

06/24/2013

ConstraintanAssemblyWorkplanewithaComponentOccurenceWorkplane?
ByAugustoGoncalves(http://adndevblog.typepad.com/manufacturing/augustogoncalves.html)
TheAddFixedmethodcreatesaworkplaneatthespecifiedpositioninspace,butitisnotgrounded.Placingaconstraintontheworkplanecouldcauseittomovedependingonwhatitis
beingconstrainedtoandthebehaviorofthesolver.Thefactthatitisnotgroundedandstillhavesixdegreesoffreedomavailableallowsthesolvertorepositionitasneeded.
Asaworkaround,pleasesetoAssyPlane.Grounded=TruebeforeAddMateConstraintandsetGroundedbacktoitsoriginalvalue.
Thecodebelowassumestwooccurrencesinoneassembly.Thecoordinatesystemofthesecondoccurrenceisnotalignedwiththeassemblys.
PublicSubMateConstraintOfWorkPlanes()

'gettheactivecomponentdefinition
DimoAsmCompDefAsAssemblyComponentDefinition
oAsmCompDef=m_inventorApplication._
ActiveDocument.ComponentDefinition

'gettheworkplane
DimoAssyPlaneAsWorkPlane
DimOPtAsPoint=Nothing
DimXVAsUnitVector=Nothing
DimYVAsUnitVector=Nothing
oAsmCompDef.WorkPlanes(2)._
GetPosition(OPt,XV,YV)
'andaddfixed
oAssyPlane=oAsmCompDef._
WorkPlanes.AddFixed(OPt,XV,YV)

'creategeometryproxy
DimoOcc1AsComponentOccurrence
oOcc1=oAsmCompDef.Occurrences(2)
DimoPartPlaneXZAsWorkPlane
oPartPlaneXZ=oOcc1.Definition.WorkPlanes(2)
DimoPartPlane1AsWorkPlaneProxy=Nothing
oOcc1.CreateGeometryProxy(_
oPartPlaneXZ,oPartPlane1)

'andfinallyaddtheconstraint
DimoldVAsBoolean
oldV=oAssyPlane.Grounded
oAssyPlane.Grounded=True
oAsmCompDef.Constraints.AddMateConstraint(_
oPartPlane1,oAssyPlane,0)
oAssyPlane.Grounded=oldV
EndSub

Postedat01:39PMinAugustoGoncalves(http://adndevblog.typepad.com/manufacturing/augustogoncalves/),Inventor(http://adndevblog.typepad.com/manufacturing/inventor/)|
Permalink(http://adndevblog.typepad.com/manufacturing/2013/06/constraintanassemblyworkplanewithacomponentoccurenceworkplane.html)
(http://twitter.com/share?
url=http%3A%2F%2Fbit.ly%2F18bIkY5&text=Constraint%20an%20Assembly%20Workplane%20with%20a%20ComponentOccurence%20Workplane%3F)
(https://plus.google.com/share?url=http://adndevblog.typepad.com/manufacturing/2013/06/constraintanassemblyworkplanewithacomponentoccurenceworkplane.html)
(http://www.facebook.com/sharer.php?u=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2013%2F06%2Fconstraintanassemblyworkplanewitha
componentoccurenceworkplane.html)

Comments

Commentbeloworsigninwith Typepad(http://www.typepad.com/sitelogin?uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2013%2F06%2Fconstraintan
assemblyworkplanewithacomponentoccurence
workplane.html&fp=d28ebcde4daf1f89eba49b27d59782e3&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&post_uri=http://adndevblog.typepad.com/manufacturing/2013
anassemblyworkplanewithacomponentoccurenceworkplane.html) Facebook(http://www.typepad.com/sitelogin?
uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2013%2F06%2Fconstraintanassemblyworkplanewithacomponentoccurence
workplane.html&fp=d28ebcde4daf1f89eba49b27d59782e3&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&service=facebook&post_uri=http://adndevblog.typepad.com/m
anassemblyworkplanewithacomponentoccurenceworkplane.html) Twitter(http://www.typepad.com/sitelogin?
uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2013%2F06%2Fconstraintanassemblyworkplanewithacomponentoccurence
workplane.html&fp=d28ebcde4daf1f89eba49b27d59782e3&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&service=twitter&post_uri=http://adndevblog.typepad.com/man
anassemblyworkplanewithacomponentoccurenceworkplane.html) Google+(http://www.typepad.com/sitelogin?
uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2013%2F06%2Fconstraintanassemblyworkplanewithacomponentoccurence
workplane.html&fp=d28ebcde4daf1f89eba49b27d59782e3&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&service=gplus&post_uri=http://adndevblog.typepad.com/manu

http://adndevblog.typepad.com/manufacturing/2013/06/constraintanassemblyworkplanewithacomponentoccurenceworkplane.html

1/2

21/01/2017

ConstraintanAssemblyWorkplanewithaComponentOccurenceWorkplane?ManufacturingDevBlog

anassemblyworkplanewithacomponentoccurenceworkplane.html)andmore...(http://www.typepad.com/sitelogin?
uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2013%2F06%2Fconstraintanassemblyworkplanewithacomponentoccurence
workplane.html&fp=d28ebcde4daf1f89eba49b27d59782e3&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&service=openid&post_uri=http://adndevblog.typepad.com/man
anassemblyworkplanewithacomponentoccurenceworkplane.html)

(URLsautomaticallylinked.)

Emailaddressisnotdisplayedwithcomment.

Name
EmailAddress
WebSiteURL
Post Preview

(http://www.typepad.com/)
ManufacturingDevBlog(http://adndevblog.typepad.com/manufacturing/)

http://adndevblog.typepad.com/manufacturing/2013/06/constraintanassemblyworkplanewithacomponentoccurenceworkplane.html

2/2

You might also like