Parameters

Parameters

GosponZ
Collaborator Collaborator
698 Views
13 Replies
Message 1 of 14

Parameters

GosponZ
Collaborator
Collaborator

I do have lot old files i need to add True/ False Parameter  ABC . Can somebody help please. Thanks

0 Likes
Accepted solutions (2)
699 Views
13 Replies
Replies (13)
Message 2 of 14

bradeneuropeArthur
Mentor
Mentor

You van do that with Windows Explorer selves!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
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:
My 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 !


 


EESignature

0 Likes
Message 3 of 14

GosponZ
Collaborator
Collaborator

iLogic code would be nice. Do not understand with Windows explorer

0 Likes
Message 4 of 14

bradeneuropeArthur
Mentor
Mentor
  1. Select files
  2.  
  3. bradeneuropeArthur_0-1628252199335.pngbradeneuropeArthur_1-1628252306255.png

     

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
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:
My 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 !


 


EESignature

Message 5 of 14

GosponZ
Collaborator
Collaborator

Thanks for you replay but this is what i need

GosponZ_0-1628253015701.png

 

0 Likes
Message 6 of 14

bradeneuropeArthur
Mentor
Mentor

Correct I have read wrong!

 

I will help you further...

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
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:
My 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 !


 


EESignature

Message 7 of 14

bradeneuropeArthur
Mentor
Mentor
Accepted solution
Dim d As Inventor.FileDialog
 Call ThisApplication.CreateFileDialog(d)
d.MultiSelectEnabled = True
d.Filter = "Parts|*.ipt"
d.ShowOpen
d.CancelError = False
If Not d.FileName = "" Then
	Dim a() As String = Split(d.FileName, "|")

i=0
For i = 0 To UBound(a)
Dim odoc As Inventor.PartDocument = ThisApplication.Documents.Open(a(i))
odoc.ComponentDefinition.Parameters.UserParameters.AddByValue("ABC", True, "BOOLEAN")
odoc.Save
	odoc.Close
Next 

End If

EDIT 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
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:
My 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 !


 


EESignature

0 Likes
Message 8 of 14

GosponZ
Collaborator
Collaborator

Great it is working. Before close and accept let me ask you this. Can it be done if part is already open, or can it be done to run code from assembly in all parts?

Appreciate once again for you time and help

0 Likes
Message 9 of 14

bradeneuropeArthur
Mentor
Mentor

sure.

You mean for the active part also put parameter ABC = true/false

and loop through assembly parts and put parameter ABC = true/false

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
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:
My 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 !


 


EESignature

Message 10 of 14

GosponZ
Collaborator
Collaborator

Yes

0 Likes
Message 11 of 14

bradeneuropeArthur
Mentor
Mentor
Accepted solution
Sub main
Dim a As AssemblyDocument = ThisApplication.ActiveDocument

loopi(a)

End Sub

 Sub Loopi(a As AssemblyDocument)
	Dim c As ComponentOccurrence 
For Each c In a.ComponentDefinition.Occurrences
	Dim d As Document = c.Definition.Document
	
	If d.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject
		loopi(d)
	Else If d.DocumentType = DocumentTypeEnum.kPartDocumentObject
		Dim p As PartDocument = Nothing
	p = d
	p.ComponentDefinition.Parameters.UserParameters.AddByValue("ABCD",True,"BOOLEAN")
	
	End If
	
	Next
End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
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:
My 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 !


 


EESignature

Message 12 of 14

GosponZ
Collaborator
Collaborator

Thank you so much, lot time will save me.

Message 13 of 14

bradeneuropeArthur
Mentor
Mentor

Good to hear!

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
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:
My 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 !


 


EESignature

0 Likes
Message 14 of 14

cadman777
Advisor
Advisor

@bradeneuropeArthur,

Thanks for this rule.

It works a charm!

Thing is, I need a few more options on it.

Would you please show me how?

First I need to replace the value with the name of a parameter (G_L).

Then I need to Export the parameter, and then format the units of the parameter to decimal 3 places, no zeros and no unit string. If you can point me in the right direction I would be grateful. I keep getting an error about the 'document class' when I try to cut-and-paste other code I find in this forum into this rule. Here is what I did so far:

 

'Create user parameter in part file after checking for existence and then adding a value to it and formatting it and exporting it

Sub Main
Dim a As AssemblyDocument = ThisApplication.ActiveDocument

Loopi(a)

End Sub

 Sub Loopi(a As AssemblyDocument)
	Dim c As ComponentOccurrence 
For Each c In a.ComponentDefinition.Occurrences
	Dim d As Document = c.Definition.Document
	
	If d.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject
		Loopi(d)
	Else If d.DocumentType = DocumentTypeEnum.kPartDocumentObject
		Dim p As PartDocument = Nothing
	p = d
	p.ComponentDefinition.Parameters.UserParameters.AddByValue("G_LD", G_L, UnitsTypeEnum.kInchLengthUnits)
	
	End If
	
	Next
End Sub

 

I believe I have to 'expose' the parameter so it can be changed, but don't know how to do it.

Here is a link showing some code to do that, but I don't know how to integrate it into your rule.

Here is the code from that link:

 

param =Parameter.Param("G_L") 
param.ExposedAsProperty = True 
param.CustomPropertyFormat.Precision = kThreeDecimalPlacesPrecision 
param.CustomPropertyFormat.ShowTrailingZeros = False 
param.CustomPropertyFormat.ShowLeadingZeros = False 
param.CustomPropertyFormat.ShowUnitsString = False 
param.CustomPropertyFormat.Units = "in" 

 

Also, I do not understand what this is doing:

If d.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject
		Loopi(d)
	Else If d.DocumentType = DocumentTypeEnum.kPartDocumentObject
		Dim p As PartDocument = Nothing
	p = d

Thanx...Chris

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes