I've been working on an assembly and I'm facing some difficulties. My objective is to constrain a component's sketch point or work plane to the assembly's center of gravity (CoG). Despite trying various methods, I haven't been successful.
I was wondering if this task could be accomplished using iLogic? I'm relatively new to iLogic, so any guidance on this would be incredibly helpful.
Here's what I've attempted so far:
Determining the Center of Gravity: Using the "Center of Gravity" command, I can visualize the CoG of the assembly. However, utilizing this point directly for constraints has proven to be challenging.
Reference Geometry Creation: I tried creating reference geometry (such as a work point or work plane) at the CoG. While I can create these references, constraining my component’s sketch point or work plane to these references hasn't yielded the desired results.
Is there a way to leverage iLogic to simplify this process? If so, a step-by-step explanation or any example codes would be immensely valuable.
Solved! Go to Solution.
Solved by bradeneuropeArthur. Go to Solution.
Solved by bradeneuropeArthur. Go to Solution.
Solved by bradeneuropeArthur. Go to Solution.
Could you share a component that needs to be constraint in the assembly, the assembly file is not needed in this case?
Could you also give me the sketchpoint you need to use?
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
I'm trying to constrain the sketch point center of the 6.010 rectangle to the CoG.
Here you have a piece of code that created a UCS at the center of Gravity (Center Of Mass).
Herewith you can constraint the component....
Sub main
Dim oDoc As AssemblyDocument = ThisAssembly.Document
Dim oCompDef As AssemblyComponentDefinition
oCompDef = oDoc.ComponentDefinition
Dim acg As MassProperties = oCompDef.MassProperties
Dim p As Point = acg.CenterOfMass
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
Dim oMatrix As Matrix
oMatrix = oTG.CreateMatrix
Dim oTranslationMatrix As Matrix
oTranslationMatrix = oTG.CreateMatrix
Call oTranslationMatrix.SetTranslation(oTG.CreateVector(p.X, p.Y, p.Z))
Call oMatrix.TransformBy(oTranslationMatrix)
Dim oUCSDef As UserCoordinateSystemDefinition
oUCSDef = oCompDef.UserCoordinateSystems.CreateDefinition
oUCSDef.Transformation = oMatrix
Dim oUCS As UserCoordinateSystem
oUCS = oCompDef.UserCoordinateSystems.Add(oUCSDef)
End Sub
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Appreciated...
Let me know if I can do something else for you.
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
sure:
Sub main
' Create a new part document
Dim oDoc As AssemblyDocument = ThisAssembly.Document
Dim oCompDef As AssemblyComponentDefinition
oCompDef = oDoc.ComponentDefinition
Dim acg As MassProperties = oCompDef.MassProperties
Dim p As Point = acg.CenterOfMass
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
' Create an identity matrix
Dim oMatrix As Matrix
oMatrix = oTG.CreateMatrix
Dim oTranslationMatrix As Matrix
oTranslationMatrix = oTG.CreateMatrix
Call oTranslationMatrix.SetTranslation(oTG.CreateVector(p.X, p.Y, p.Z))
Call oMatrix.TransformBy(oTranslationMatrix)
' Create an empty definition object
Dim oUCSDef As UserCoordinateSystemDefinition
oUCSDef = oCompDef.UserCoordinateSystems.CreateDefinition
oUCSDef.Transformation = oMatrix
Dim oUCS As UserCoordinateSystem
Try
oUCS = oCompDef.UserCoordinateSystems.Item("UCS_COG")
oUCS.Transformation = oMatrix
Catch
oUCS = oCompDef.UserCoordinateSystems.Add(oUCSDef)
oUCS.Name = "UCS_COG"
End Try
End Sub
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
I think now you are asking me, it is better to create a add-in for Inventor because you could use the Events better.
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Are you a bit familiar with Vb.net?
For now you can also add the rule to the save Event found in the Ilogic Event Triggers...
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Hi Arthur,
I'm not very familiar with VB.NET. Could you please provide some guidance or resources on how to add the CG auto-update rule to the save event using the iLogic Event Triggers?
Thanks,
Dan
Can't find what you're looking for? Ask the community or share your knowledge.