ilogic code to remove the linked file from parameter of a .ipt or .iam

ilogic code to remove the linked file from parameter of a .ipt or .iam

nowell.colsenXK53F
Enthusiast Enthusiast
185 Views
3 Replies
Message 1 of 4

ilogic code to remove the linked file from parameter of a .ipt or .iam

nowell.colsenXK53F
Enthusiast
Enthusiast

looking for an ilogic code to remove the linked file from parameter of a .ipt or .iam that has been linked. Looking for a fast way to unlink .ipt or .iam from there linked part. The master file that is linked is itself a .ipt file

nowellcolsenXK53F_0-1739191581180.png

 

0 Likes
186 Views
3 Replies
Replies (3)
Message 2 of 4

m_baczewski
Advocate
Advocate

Hi,

I'm sending a short piece of code that shows how to remove all linked files from an assembly file. Is this exactly what you were looking for? Or do you want to go through the entire assembly and remove them from all parts and subassemblies?

Sub main()
	
	Dim oDoc As AssemblyDocument = ThisDoc.Document
	Dim oAssemblyCompDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
	
	Dim oParams As Parameters = oAssemblyCompDef.Parameters
	Dim oDerviedParamsTables As DerivedParameterTables = oParams.DerivedParameterTables
	
	For Each oDerivedParamTable As DerivedParameterTable In oDerviedParamsTables
		oDerivedParamTable.Delete()
	Next
	
End Sub
	
0 Likes
Message 3 of 4

nowell.colsenXK53F
Enthusiast
Enthusiast

Yes and no, the main linked file is an .ipt, the files its link to is either a .ipt or .iam.  but what you sent I think I can rewrite it to work in both .ipt or iam file. My main goal is to remove all links from the user parameters then delete the linked file, So I dont end up with new user Parameters with _1. if that makes sense? 

0 Likes
Message 4 of 4

mateusz_baczewski
Advocate
Advocate

I understand you but i need ane example. Can you send a small example of a part or assembly to show how it looks?

It seems to me that if you delete linked files and a part/assembly uses parameters from that linked file, then after removing those files, parameters with the same names are automatically created. Unless the linked files have parameters with the same names, in which case "_1" is added to the parameter name.

If you found it helpful, a "Like" would be much appreciated!
If this post solved your problem, please mark it as "Solution.".

0 Likes