D.S

adndevblog.typepad.com

Constraint an Assembly Workplane with a ComponentOccurence Workplane? - Manufacturing DevBlog

Constraint an Assembly Workplane with a ComponentOccurence Workplane? - Manufacturing DevBlog Manufacturing DevBlog The resource for software developers working with Design, Lifecycle and Simulation technologies from Autodesk. Home Subscribe Follow Useful Links Autodesk About this Blog « Set Visibility of Sketch in sub assembly | Main | Use VB.NET dialog in iLogic » 06/24/2013 Constraint an Assembly Workplane with a ComponentOccurence Workplane? By Augusto Goncalves The AddFixed method creates a work plane at the specified position in space, but it is not grounded.  Placing a constraint on the work plane could cause it to move depending on what it is being constrained to and the behavior of the solver.  The fact that it is not grounded and still have six degrees of freedom available allows the solver to reposition it as needed. As a workaround, please set oAssyPlane.Grounded = True before AddMateConstraint and set Grounded back to its original value. The code below assumes two occurrences in one assembly. The coordinate system of the second occurrence is not aligned with the assembly’s. Public Sub MateConstraintOfWorkPlanes()     ' get the active component definition   Dim oAsmCompDef As AssemblyComponentDefinition   oAsmCompDef = m_inventorApplication. _     ActiveDocument.ComponentDefinition     ' get the workplane   Dim oAssyPlane As WorkPlane   Dim OPt As Point = Nothing   Dim XV As UnitVector = Nothing   Dim YV As UnitVector = Nothing   oAsmCompDef.WorkPlanes(2). _     GetPosition(OPt, XV, YV)   ' and add fixed   oAssyPlane = oAsmCompDef. _     WorkPlanes.AddFixed(OPt, XV, YV)     ' create geometry proxy   Dim oOcc1 As ComponentOccurrence   oOcc1 = oAsmCompDef.Occurrences(2)   Dim oPartPlaneXZ As WorkPlane   oPartPlaneXZ = oOcc1.Definition.WorkPlanes(2)   Dim oPartPlane1 As WorkPlaneProxy = Nothing   oOcc1.CreateGeometryProxy( _     oPartPlaneXZ, oPartPlane1)     ' and finally add the constraint   Dim oldV As Boolean   oldV = oAssyPlane.Grounded   oAssyPlane.Grounded = True   oAsmCompDef.Constraints.AddMateConstraint( _     oPartPlane1, oAssyPlane, 0)   oAssyPlane.Grounded = oldV End Sub Posted at 01:39 PM in Augusto Goncalves , Inventor | Permalink | | | Comments Constraint an Assembly Workplane with a ComponentOccurence Workplane? By Augusto Goncalves The AddFixed method creates a work plane at the specified position in space, but it is not grounded.  Placing a constraint on the work plane could cause it to move depending on what it is being constrained to and the behavior of the solver.  The fact that it is not grounded and still have six degrees of freedom available allows the solver to reposition it as needed. As a workaround, please set oAssyPlane.Grounded = True before AddMateConstraint and set Grounded back to its original value. The code below assumes two occurrences in one assembly. The coordinate system of the second occurrence is not aligned with the assembly’s. Public Sub MateConstraintOfWorkPlanes()     ' get the active component definition   Dim oAsmCompDef As AssemblyComponentDefinition   oAsmCompDef = m_inventorApplication. _     ActiveDocument.ComponentDefinition     ' get the workplane   Dim oAssyPlane As WorkPlane   Dim OPt As Point = Nothing   Dim XV As UnitVector = Nothing   Dim YV As UnitVector = Nothing   oAsmCompDef.WorkPlanes(2). _     GetPosition(OPt, XV, YV)   ' and add fixed   oAssyPlane = oAsmCompDef. _     WorkPlanes.AddFixed(OPt, XV, YV)     ' create geometry proxy   Dim oOcc1 As ComponentOccurrence   oOcc1 = oAsmCompDef.Occurrences(2)   Dim oPartPlaneXZ As WorkPlane   oPartPlaneXZ = oOcc1.Definition.WorkPlanes(2)   Dim oPartPlane1 As WorkPlaneProxy = Nothing   oOcc1.CreateGeometryProxy( _     oPartPlaneXZ, oPartPlane1)     ' and finally add the constraint   Dim oldV As Boolean   oldV = oAssyPlane.Grounded   oAssyPlane.Grounded = True   oAsmCompDef.Constraints.AddMateConstraint( _     oPartPlane1, oAssyPlane, 0)   oAssyPlane.Grounded = oldV End Sub View the entire comment thread. Please enable JavaScript if you would like to comment on this blog. Search Submit Mfg DevBloggers Adam Nagy Augusto Goncalves Balaji Ramamoorthy Daniel Du Philippe Leefsma Vladimir Ananyev Wayne Brill Xiaodong Liang November 2016 Sun Mon Tue Wed Thu Fri Sat     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30       Autodesk Blogs ADN DevBlog - AEC Our DevBlog for Revit, Navisworks, AEC and BIM technology APIs. ADN DevBlog - AutoCAD Our DevBlog for AutoCAD and other platform technology APIs. ADN DevBlog - Cloud and Mobile Our DevBlog for Cloud and Mobile technologies. ADN DevBlog - Infrastructure Modeling Our DevBlog for Infrastructure Modeling technology APIs. ADN DevBlog - Manufacturing Our DevBlog for Design, Lifecycle and Simulation technologies. Around the Corner Cyrille Fauvel's Maya platform developer blog - Autodesk Media and Entertainment technology. Civilized Development Isaac Rodriguez's AutoCAD Civil 3D developer blog Dances with Elephants Jim Quanci's