Link parameter from one part to another part

Link parameter from one part to another part

cadman777
Advisor Advisor
4,610 Views
71 Replies
Message 1 of 72

Link parameter from one part to another part

cadman777
Advisor
Advisor

Hi All,

Does anybody have any simple rule that will take a Parameter from one part and push it into another part and format it the way you want it to be formatted?

Here's what I'm trying to do:

1. All driving iProperties and Parameters are located in the master sketch (ipt), which is derived into all manually made parts, but not derived into any of the FrameGenerator parts.

2. I need certain iProperties and Parameters linked from the master sketch to certain FG parts.

3. I also need to format the Parameters.

4. And then I need to copy the resulting Parameter value into another iProperty in that part file.

I can do #4, but can't figure out how to do #1-#3.

I figured the way to do it is to open the master sketch and run the rules from it on the parts I select through a file dialogue box. Or run them using a rule that calls rules and runs them (I've done that before).

Any help is very much appreciated, since I'm out of my depth every time I try to make a rule!

... 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
4,611 Views
71 Replies
Replies (71)
Message 2 of 72

A.Acheson
Mentor
Mentor

Any chance of getting a data set of the assembly and parts even if they are empty shells with the relevant parameter and iproperty?

Your workflow sounds very specific so it would be good to work with the data set and parameters names you are using. Is the workflow consistent in that you can target the files you want by name or portion of a name each time? If not you would need a rule to be able to select which files you want to customize each time. 

You can do some Frame generator filtering by the “has interest in” method if the names are not consistent enough to target the file by a categorized name. 

A couple of screenshots or a list of which parameters link to where will help too. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 72

blandb
Mentor
Mentor

I had found some code to apply information to FG parts only, I had modified it to set a custom iProperty for what I needed in the FG parts, but you could adjust to pull in what you want. See if this can help you.

 

Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
Dim oDoc As Document
For Each oDoc In oAsmDoc.AllReferencedDocuments
	
    If oDoc.DocumentInterests.HasInterest("{AC211AE0-A7A5-4589-916D-81C529DA6D17}") _ 'Frame generator component
       AndAlso oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject _'Part
       AndAlso oDoc.IsModifiable _ 'Modifiable (not reference skeleton)
       AndAlso oAsmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oDoc).Count > 0'Exists in assembly (not derived base component)

		Dim filename = IO.Path.GetFileName(oDoc.FullFileName)
		iProperties.Value(filename, "Custom", "RAIL SECTION") = Right(iProperties.Value(oAsmDoc, "Project", "Part Number"),9)
		End If
Next

  

Autodesk Certified Professional
0 Likes
Message 4 of 72

cadman777
Advisor
Advisor

Thanx Alan.

I'll try to make time today to throw something together that's representative with explanation.

But there would be no set filename, so there would need to be user interaction to pick the files to be processed.

Filtering is always the problem with applying coding.

I had to make Custom iProperties to categorize for that, but it's now out of control.

Then, the iProperties aren't even standardized for this, b/c we're talking about cost accounting.

You'll see what I mean in my example dataset.

I just want to be able to have a column in the drawing PartsList that shows the Estimated Cost of each line item.

Ideally, at the bottom I want to show a Total for that Estimated Cost too that automatically updates, so I don't have to manually add them up each time.

Anyway, I'll get to it later when I have time, or else on Sunday.
Thanx for helping...

 

... 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
Message 5 of 72

cadman777
Advisor
Advisor

Thanx for this code.

This is what I see with your rule:

1. it runs inside an assembly document

2. it filters using 4 criteria (fg+part+editable+non-derived)

3. it identifies each part in the assembly by its filename and changes the value of each part's Custom iProperty named RAIL SECTION to the assembly's Project iProperty named "Part Number".

What does "9" do?

Please tell me if I didn't understand correctly.

 

Also, can you suggest how I can link an iProperty from another part file to all of these assembly files?


It would seem that I can declare a variable and hard code it with a path+filename of the file I want to get the iProperty from, and then get the value of that iProperty, and then insert it into the iProperty that was created in the FG part (above). Have you ever done that? Seems like it would be only 2 lines added to the end of your rule.

 

If I knew how to look up this stuff in the gigantic morass of Inventor VBA/iLogic 'Help', I might be able to attempt it. But I still can't settle on a work-flow to go from idea to code. Too many undocumented things I don't know how to figure out how or where to find.

 

Thanx for helping.

I'll try it later when I try to carve out time for this.

... 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
Message 6 of 72

blandb
Mentor
Mentor

The right function is doing some trimming of part numbers for what I was doing. It will not be a 1:1 for what you need, but should get you in the right direction. Sounds like you are properly understanding what the code is doing. I use this rule at my FG level.

Autodesk Certified Professional
0 Likes
Message 7 of 72

blandb
Mentor
Mentor

For costing, are you placing the cost/part in the iproperties? For example, widget a cost $34.26 to make. Then when you place say 5 of them in an assembly, in your parts list you can add the $/COMP. property. Edit the column and go to the substitution tab, and then Sum up the values. This way you get a live update of the cost of the qty. of parts.

 

I had then found some code that will scan the assy and total all the cost of the items and place that into the main assy esimated cost field. Then you can add that as a note referencing that property in the drawing:

 

Sub Main TraverseAssemblySample()
    ' Get the active assembly.
    Dim oAsmDoc As AssemblyDocument
     oAsmDoc = ThisApplication.ActiveDocument
	 
	 Dim oCost As Decimal
	 oCost = 0

    ' Call the function that does the recursion.
    Call TraverseAssembly(oAsmDoc.ComponentDefinition.Occurrences, 1, oCost)
	
	iProperties.Value("Project", "Estimated Cost")= oCost
End Sub

Private Sub TraverseAssembly(ByVal Occurrences As ComponentOccurrences, _
							 ByVal Level As Integer, _
							 ByRef oCost As Double)
    ' Iterate through all of the occurrence in this collection.  This
    ' represents the occurrences at the top level of an assembly.
    For Each oOcc As ComponentOccurrence In Occurrences
	
		' Skip Phantom and reference parts.
		If oOcc.BOMStructure = BOMStructureEnum.kPhantomBOMStructure _ 
		Or oOcc.BOMStructure = BOMStructureEnum.kReferenceBOMStructure Then
			Continue For
		End If
		
		' Get the document file for this occurrence
		Dim oDoc As Document
		oDoc = oOcc.Definition.Document
			
		' Get the iPropertySet that constains the estimated cost property
		Dim oPropSet As PropertySet
		oPropSet = oDoc.PropertySets.Item("Design Tracking Properties")
		
		' Get the cost of this occurrence
		oCost += oPropSet.Item("Cost").Value
		
        ' Check to see if this occurrence represents a subassembly
        ' and recursively call this function to traverse through it.
        If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then
            Call TraverseAssembly(oOcc.SubOccurrences, Level + 1, oCount)
        End If
    Next
End Sub
Autodesk Certified Professional
0 Likes
Message 8 of 72

A.Acheson
Mentor
Mentor

@cadman777 

If your part file you want to transfer information to is in the assembly you are working you can get the file in advance of working with the frame generator documents. Place immediately under the start of the For loop for all documents. 

 

'Get pat to work method 1
Dim oPart1 as PartDocument oPart1 = oDoc.DisplayName("Part1")

 If the file is external to the assembly supply you will need to open the file visible or not  and transfer after that. 

 

Regarding navigating the API help key word document, browse to assembly or part, look for open and you should find a sample.

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 9 of 72

cadman777
Advisor
Advisor

Thanx for that code, but that's now what I'm after.

 

I'm not quite remembering how I did this last time, but I believe I opened all the parts I wanted to change, then one at a time ran the rule. That saved me 50 mouse and keyboard presses per file, and reduced the time required to process them to 1/10 at least.

 

What I'm trying to do is Link (at the bottom of the Parameters dialog) one parameter from one file to all the others that are opened. In the rule I can specify the name of the file that will be linked (the source file) as a declared variable (that filename won't change for this project), and specify the Parameter I want linked. But what I don't know how to do is write code to make that LINK from the master file to an opened file. See attached pdf.

 

... 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
Message 10 of 72

A.Acheson
Mentor
Mentor

Now I see, yes that is most likely the most complicated way to do it as your deriving the parameter to other files. This post dealt with deriving parameters and tbh I was just learning so there is lots of mistakes and posts in there to learn from

https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/i-logic-for-derived-part/m-p/10589543#M...

 

Is it possible to write down the steps (Plan) in excel tightly with each step to explain the process you need. Have a notes column write link(parameter like the link button in parameters box)

 

Plan

1. Parameter file ,link(parameter like the link button in parameters box) to open visible files. 

* This is called deriving and we can’t derive be without the files*


2. Regarding the files you want to process you can use a loop for visible documents but excluding the one your working from (parameter file)

Example here

3. Derive parameter from parameter file into visible files. 

There maybe be multiple other ways to achieve this like placing all parts in an assembly and linking the parameters there. Just a thought. 

 

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 11 of 72

cadman777
Advisor
Advisor

I've done #2 previously and it works.

But I forget the work-flow b/c it was so long ago.

But it's no big deal, I can figure it out.

Anyway, that's what I want to do.

So if I have the basic code, and can declare the path+filename in the rule, then I can just run the rule on all open files.

Simple as that.

... 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
Message 12 of 72

cadman777
Advisor
Advisor

After some thought, I changed my mind.

Find attached a dataset to a simple model that has all the basic stuff in it that I'm talking about.

The explanation is in the idw file Note at the top left.

I found a simpler way than linking the Parameter from one part to another.

Thanx for helping!

... 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
Message 13 of 72

cadman777
Advisor
Advisor

I changed my mind and want to keep all the parameters in the master sketch.

Find attached an updated master sketch ("_Wireframe-...ipt")

... 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
Message 14 of 72

cadman777
Advisor
Advisor

This looks like one part of it.

That's what I decided to do.

Put the total parts cost in the Assembly 'Estimated Cost' iProperty and then put that into a text entity on the drawing right under the PartsList column 'Cost'. This looks like it will put that number into that iProperty.

I'm going to wait to give a SOLVED on this at till the end b/c this is only 1 part of the process.

Thanx!

... 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
Message 15 of 72

cadman777
Advisor
Advisor

This also looks like it can do part of what I need.

I have to try both separately to see if they work.

I'll just run them from an iLogic rule that runs a rule on all opened parts.

That way it can be done easily with less coding.

I'll check SOLVED when I'm all done.

Thanx for this!

... 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
Message 16 of 72

cadman777
Advisor
Advisor

OK, great.

Thanx again.

Let me bend my brain around it a bit and see what shakes out...

... 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
Message 17 of 72

cadman777
Advisor
Advisor

OK, thanx.

... 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
Message 18 of 72

NachoShaw
Advisor
Advisor

FYI

 

in your custom property RAIL SECTION, you could simply type =<Part Number> and it will convert to a function and then inherit the Part Number property value without any code.

 

PropertyFunction.gif

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 19 of 72

cadman777
Advisor
Advisor

Between yesterday and today I spent a total of 10 hours trying to make a SIMPLE RULE do a SIMPLE TASK that would take me 1/2 an hour to do manually. On big projects is where this rule would come in handy. Yet, AFTER ALL THAT, I can't figure out how to writ the "macro". TOO MANY RULES AND WORDS. NOTHING SIMPLE in iLogic, VBA or VB.Net, NOTHING WHATSOEVER.

Note: I do NOT have this problem with using VISUAL MACRO like RHINO3Dhas built into it.

It's not MY job to DEVELOP this software, it's AUTODESK's.

 

Take note Autodesk:
If you want people who THINK VISUALLY for a living to automate their work (instead of you doing it for them, which is your job), then provide them a VISUAL MACRO environment to do it, not this B.S. called iLogic, VBA, VB.Net, or C#. It's the height of STUPIDITY to provide to MECHANICAL engineers a rule-making environment that's suitable to ELECTRICAL engineers. Think about it: You provide a MECHANICAL ENGINEERING GRAPHICS software. MAKE IT MECHANICAL! Don't be STUPID. What kind of ignorant IDIOT makes these kinds of decisions?

... 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
Message 20 of 72

NachoShaw
Advisor
Advisor

mate

 

each platform has its own way of working. Granted iLogic isnt the most intuitive and i personally avoid it as much as possible but it does have its benefits. Its worst thing is the lack if intellisense. it gives some but not all...

 

Anyway

 

Can you bullet point out what you need to achieve? That would help some late comers (me) understand the reqs without deciphering the threads. As for all documents, you can loop through all of the open documents, check the document type and then apply the rule as needed.

 

reply with a list, i'll see what i can rustle out for you

 

 

Cheers

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes