COPY parameters via iLogic between 2 ipt parts

COPY parameters via iLogic between 2 ipt parts

mblaptok
Contributor Contributor
833 Views
7 Replies
Message 1 of 8

COPY parameters via iLogic between 2 ipt parts

mblaptok
Contributor
Contributor

I've got 2 files A.IPT and B.IPT, which are not linked (i don't want it). All i want i just copy parameters via iLogic (not interested by import/export to xml)

 

I tried this code (run from file A.IPT), but i have an error "...B.IPT was not found"

Parameter("partA") = Parameter("B.IPT", "partB")

 What should I do, that Inventor will see B.IPT and than copy parameters.

Is there a simple solution for it? (without linking!)

Thank's

0 Likes
Accepted solutions (1)
834 Views
7 Replies
Replies (7)
Message 2 of 8

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Maybe this is an option:

derive A in B and than Break Link with A....

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 8

mblaptok
Contributor
Contributor

Thank's but  this is not an option, these are independent parts, moreover, once I want to copy parameters from A to B, and another time from B to A.

 

I also don't want to create an additional file eg. C.IPT with parameters (linked to A&B)

0 Likes
Message 4 of 8

bradeneuropeArthur
Mentor
Mentor

Could this help you?

 

Public Sub main()

Dim a As Application
a = ThisApplication

Dim thispart As PartDocument
 thispart = a.ActiveDocument

Dim b As FileDialog
Call a.CreateFileDialog(b)
b.FileName = "" '"C:\Temp\Temp.ipt"

b.Filter = "Inventor Part Files (*.ipt)|*.ipt"
b.ShowOpen



Dim refdoc As PartDocument
refdoc = a.Documents.Open(b.FileName, False)

Dim pa As Parameter
pa = refdoc.ComponentDefinition.Parameters.Item("YourName")

thispart.ComponentDefinition.Parameters.UserParameters.AddByValue (pa.Name, pa.Value,"mm")


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

0 Likes
Message 5 of 8

bradeneuropeArthur
Mentor
Mentor

Modified a little to have the correct units

 

Public Sub main()

Dim a As Application
a = ThisApplication

Dim thispart As PartDocument
thispart = a.ActiveDocument

Dim b As FileDialog
Call a.CreateFileDialog(b)
b.FileName = "d:\" 

b.Filter = "Inventor Part Files (*.ipt)|*.ipt"
b.ShowOpen

MsgBox b.FileName

Dim refdoc As PartDocument
refdoc = a.Documents.Open(b.FileName, False)

Dim pa As Parameter
Set pa = refdoc.ComponentDefinition.Parameters.Item("YourName")

thispart.ComponentDefinition.Parameters.UserParameters.AddByValue pa.Name, pa.Value, pa.Units

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

0 Likes
Message 6 of 8

mblaptok
Contributor
Contributor

Thank You.

I removed file filtering (not needed), generally it works, but there is one big problem, if a parameter with the same name exists, it is not updated, but a new one is created with the index _1 : /

how to overcome this ?
or maybe some other method, shorter ...?

Public Sub Main()
Dim a As Application
a = ThisApplication
Dim thispart As PartDocument
thispart = a.ActiveDocument
Dim refdoc As PartDocument
refdoc = a.Documents.Open("D:\FILE.IPT", False)
Dim pa As Parameter
pa = refdoc.ComponentDefinition.Parameters.Item("test1")
thispart.ComponentDefinition.Parameters.UserParameters.AddByValue(pa.Name, pa.Value, pa.Units)
End Sub

 

0 Likes
Message 7 of 8

bradeneuropeArthur
Mentor
Mentor
Accepted solution

 

Public Sub Main()
Dim a As Application
a = ThisApplication
Dim thispart As PartDocument
thispart = a.ActiveDocument
Dim refdoc As PartDocument
refdoc = a.Documents.Open("D:\FILE.IPT", False)
Dim pa As Parameter
pa = refdoc.ComponentDefinition.Parameters.Item("test1")

Try
	
	thispart.ComponentDefinition.Parameters.UserParameters.Item(pa.name).Value = pa.Value
Catch
	thispart.ComponentDefinition.Parameters.UserParameters.AddByValue(pa.Name, pa.Value, pa.Units)	
End Try

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 8 of 8

mblaptok
Contributor
Contributor

Works good, thank's a lot !

 

I modified UserParameters, i left just Parameters... (i have both)

 

Try
	
	thispart.ComponentDefinition.Parameters.UserParameters.Item(pa.name).Value = pa.Value
Catch
	thispart.ComponentDefinition.Parameters.UserParameters.AddByValue(pa.Name, pa.Value, pa.Units)	
End Try

In parallel, I solved it in a similar way,  it also works good.

 

Dim oModel As PartDocument
Dim doc = ThisDoc.WorkspacePath
FilePath = doc + "\TEST.IPT"
oModel = ThisApplication.Documents.Open(FilePath, False)
auto = iLogicVb.Automation

Parameter("test1") =   auto.ParamValue(oModel, "test1")