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: 

switch driven dimensions

3 REPLIES 3
Reply
Message 1 of 4
Nathan.r12345
179 Views, 3 Replies

switch driven dimensions

Hi, i was hoping someone can help me. 

 

Is it possible using iLogic to switch two params between driven and undriven dimensions.

 

I basically have an object in the middle of a room and i want to be able to choose an offset distance from a wall, based on which side of the room its on. Ie left or right. 

 

So in a form the user would click 'left side of room' and then input the offset from the left wall or vise versa.

 

See attched image.

 

For example:

 

if SWITCHDIRVENDIMENSION = True Then

d2 = Not driven

d3 = Driven dimension

 

if SWITCHDIRVENDIMENSION = False Then

d2 = Driven dimension

d3 = Not driven

 

Nathanr12345_0-1712891819036.png

 

3 REPLIES 3
Message 2 of 4

I have a addin for that. Let me have a look to share this ....

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 !

Message 3 of 4

Dim p As PartDocument = ThisDoc.Document
Dim pc As PartComponentDefinition = p.ComponentDefinition
Dim ps As PlanarSketch = pc.Sketches.Item(1)

Dim skd1 As DimensionConstraint = ps.DimensionConstraints.Item(1)
Dim skd2 As DimensionConstraint = ps.DimensionConstraints.Item(2)
MsgBox(skd1.Driven)
MsgBox (skd2.Driven)
If skd1.Driven = True Then
	skd2.Driven = True
	skd1.Driven = False
Else If skd2.Driven = True Then
	skd1.Driven = True
	skd2.Driven = False
End If

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 !

Message 4 of 4

Or even with a pick-command:

 

Dim p As PartDocument = ThisDoc.Document
Dim pc As PartComponentDefinition = p.ComponentDefinition
Dim ps As PlanarSketch = pc.Sketches.Item(1)
Dim s As SelectSet = p.SelectSet
Dim skd1 As DimensionConstraint
Dim skd2 As DimensionConstraint

skd1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchDimConstraintFilter, "PICK FIRST ""DRIVEN"" DIMENSION TO SWITCH!") 
Do While skd1.Driven = False
	MsgBox ("THIS DIMENSION IS NOT DRIVEN")
	skd1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchDimConstraintFilter, "PICK FIRST ""DRIVEN"" DIMENSION TO SWITCH!") 
Loop

skd2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchDimConstraintFilter, "PICK FIRST ""DRIVE"" DIMENSION TO SWITCH!") 
Do While skd2.Driven = True
	MsgBox ("THIS DIMENSION DOES NOT DRIVE")
	skd2  = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchDimConstraintFilter, "PICK FIRST ""DRIVE"" DIMENSION TO SWITCH!") 
Loop

Try
	
If skd1.Driven = True Then
	skd2.Driven = True
	skd1.Driven = False
Else If skd2.Driven = True Then
	skd1.Driven = True
	skd2.Driven = False
End If

Catch
	MsgBox("NOT POSSIBLE TO SWITCH!")
End Try

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 !

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

Post to forums  

Autodesk Design & Make Report