Link parameter from one part to another part

Link parameter from one part to another part

cadman777
Advisor Advisor
4,702 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,703 Views
71 Replies
Replies (71)
Message 61 of 72

cadman777
Advisor
Advisor

This is what I had to do to get your rule to run on IV2010:

 

 

' Get the active assembly.
    Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument

    ' Get the assembly component definition.
    Dim oAsmDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition

    ' Get all of the leaf occurrences of the assembly.
    Dim oLeafOccs As ComponentOccurrencesEnumerator = oAsmDef.Occurrences.AllLeafOccurrences

    ' Iterate through the occurrences and print the name.
    Dim oOcc As ComponentOccurrence
    For Each oOcc In oLeafOccs

       ' Dim sInfo As String = String.Empty
        Dim sInfo As String = ""
		sInfo1 = "Part name:" & oOcc.Name & vbNewLine
'		sInfo = sInfo & "Is from Content Center: " & oOcc.Definition.Document.PropertySets.PropertySetExists("ContentCenter")
		sInfo2 = "Is from Content Center: "
		sInfo3 = oOcc.Definition.Document.PropertySets.Type = "50392320" & vbNewLine

	'For parts placed from Content Center check if it was place As Standard or As Custom
'		If oOcc.Definition.Document.PropertySets.PropertySet.Exist("ContentCenter") Then
'			If oOcc.Definition.IsContentMember Then
			If sInfo3 = False Then
'				sInfo = sInfo & "And placed As Standard"
				sInfo4 =  vbNewLine & "And placed As Standard"
			Else
'				sInfo = sInfo & "And placed As Custom"
				sInfo4 = vbNewLine & "And placed As Custom"
			End If
'		End If	
		MsgBox(sInfo1 & sInfo2 & sInfo3 & sInfo4)
    Next

 

Also, I think I'm finally beginning to figure out how to use the Object Browser to traverse the Object Model. The only thing I'd like to have is a Graphic Model (like the Object Model) of each component to see what properties it has in a visual format.

 

Only problem w/this rule is, none of the CC parts show up as 'True'. That tells me 1 of 2 things:

1. There is no property for CC parts build-into each part, or

2. The rule has a flaw that prevents it from identifying CC parts.

How can I probe individual parts to see all their properties so I can see IF there's an ID tag that identifies them as CC parts?

 

... 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 62 of 72

cadman777
Advisor
Advisor

I used ClintBrown's iLogic rule to list all of a part's properties:

https://clintbrown.co.uk/2020/02/29/ilogic-write-all-iproperties-to-txt/

Not sure which property is the one that identifies the part as a CC part.

Here's the list:

Design Tracking Properties:

Creation Time --> 12/18/2014 12:37:44 PM
Part Number --> BD 4x4 - 30 1/2 Lg
Project --> 
Cost Center --> 
Checked By --> 
Date Checked --> 1/1/1601
Engr Approved By --> 
Engr Date Approved --> 1/1/1601
User Status --> 
Material --> Wood, Pressure Treated Pine
Part Property Revision Id --> {674C3BA7-CD7C-4F8C-A564-07A012CD9A50}
Catalog Web Link --> 
Part Icon --> 
Description --> Post
Vendor --> Home Depot
Document SubType --> {4D29B490-49B2-11D0-93C3-7E0706000000}
Document SubType Name --> Modeling
Proxy Refresh Date --> 12:00:00 AM
Mfg Approved By --> 
Mfg Date Approved --> 1/1/1601
Cost --> 0.0000
Standard --> AISC
Design Status --> 1
Designer --> TP
Engineer --> 
Authority --> 
Parameterized Template --> False
Template Row --> 
External Property Revision Id --> {3BAD9EB8-E984-4F48-B23B-17AFF265D051}
Standard Revision --> 2003
Manufacturer --> Ryerson
Standards Organization --> AISC
Language --> en-US
Defer Updates --> False
Size Designation --> SQ 3 1/2 x 3 1/2
Categories --> <MemberInstance><Categories><Category DisplayName="Structural Shapes" InternalName="089c4875-fa83-4c05-b084-43b9cc11f5ed" Mnemonic="GRDR"><CategoryParameter DisplayName="Custom Base Point" InternalName="4f1d1b73-316d-484b-a3df-9cbabb16eb77" Mnemonic="shpBasePoint"/><CategoryParameter DisplayName="FG Authored" InternalName="9c666724-f362-4ea7-ac62-f6a007de5c69" Mnemonic="shpFGAuto"/><CategoryParameter DisplayName="Legacy Member ID" InternalName="340afe4f-75d7-48d3-ab7d-943f3c3da468" Mnemonic="LegacyMemberID"/><CategoryParameter DisplayName="Base Length" InternalName="42e34263-8f20-4d0e-ad48-bf1385b87c24" Mnemonic="shplen"/><CategoryParameter DisplayName="Distance of the Center of Gravity X-X" InternalName="26c9bdb8-9c79-4b4f-a92e-8e197583c9c4" Mnemonic="grcendistX"/><CategoryParameter DisplayName="Distance of the Center of Gravity Y-Y" InternalName="bcc4fb17-7af4-436a-8f8c-d0aa3b0248c5" Mnemonic="grcendistY"/><CategoryParameter DisplayName="Torsional Rigidity Modulus" InternalName="26c1ec35-5026-4c63-ad0a-751cf684a536" Mnemonic="torrigmod"/><CategoryParameter DisplayName="Torsional Section Modulus" InternalName="7c55a8dc-8844-49f9-a867-cc677b30ec9a" Mnemonic="torsecmod"/><CategoryParameter DisplayName="Coefficient of Shear Displacement" InternalName="de4c90c6-aaa8-468f-a335-6737b311b5d3" Mnemonic="shdispc"/><CategoryParameter DisplayName="Section Area" InternalName="1ff91680-64b0-4202-b9a3-7fd3f94bba3b" Mnemonic="secarea"/><CategoryParameter DisplayName="Moment of Inertia (x)" InternalName="4cd780bc-73d7-43ac-917a-579e5cbd684d" Mnemonic="inermomx"/><CategoryParameter DisplayName="Moment of Inertia (y)" InternalName="4b9f58ea-bced-460e-81ea-3d29ca5a49e3" Mnemonic="inermomy"/><CategoryParameter DisplayName="Section Module (x)" InternalName="72cfad18-cf51-4ed4-aaa7-c6b224f8419f" Mnemonic="secmodx"/><CategoryParameter DisplayName="Section Module (y)" InternalName="59eaa5e9-d227-48dc-b6c1-6920f96e0f95" Mnemonic="secmody"/><CategoryParameter DisplayName="Radius of Gyration (x)" InternalName="25778675-03e9-40c1-b6a8-4a9ed693320d" Mnemonic="gyrradx"/><CategoryParameter DisplayName="Radius of Gyration (y)" InternalName="bfa18ebe-1636-4dbe-8d42-b263e0b73184" Mnemonic="gyrrady"/><CategoryParameter DisplayName="Shape Thickness" InternalName="d109cf76-8eb4-42fc-9800-4409734adc67" Mnemonic="shpthick"/><CategoryParameter DisplayName="Second Shape Thickness" InternalName="9251a8e1-85fd-4e47-af99-afdb762317d9" Mnemonic="shpthick2"/><CategoryParameter DisplayName="Shape Width" InternalName="7c717d54-a18f-4666-b4d4-573cce22c62c" Mnemonic="shpwdth"/><CategoryParameter DisplayName="Shape Height" InternalName="50274e7d-5ac0-4796-92cb-c59e54983c67" Mnemonic="shpheig"/><CategoryParameter DisplayName="Mass per Length Unit" InternalName="0bb95a10-148f-4027-a459-38d7b056702a" Mnemonic="shpmass"/><CategoryParameter DisplayName="Section Designation" InternalName="5a64d034-428d-49c8-ba32-7619764de20f" Mnemonic="shpdes"/><Category DisplayName="Square/Rectangular/Hex Bars" InternalName="44cba647-b13d-4527-b673-b65895b10784" Mnemonic="FSQR"><CategoryParameter DisplayName="Moment of Inertia (x)" InternalName="567b9070-fff7-4506-9062-c5920207e423" Mnemonic="inermomx"/><CategoryParameter DisplayName="Moment of Inertia (y)" InternalName="ac860459-9158-4b9e-884a-99b2d15b55f7" Mnemonic="inermomy"/><CategoryParameter DisplayName="Section Module (x)" InternalName="f7767b01-f838-4700-8b24-64e846803fb2" Mnemonic="secmodx"/><CategoryParameter DisplayName="Section Module (y)" InternalName="fc87fe3d-511a-472b-be8a-831ab84f2064" Mnemonic="secmody"/><CategoryParameter DisplayName="Section Area" InternalName="4c710229-c7ec-4baa-8fdb-39a097eb52ae" Mnemonic="secarea"/><CategoryParameter DisplayName="Radius of Gyration (x)" InternalName="e4f600ea-cd40-43e5-8177-81a3193c0646" Mnemonic="gyrradx"/><CategoryParameter DisplayName="Radius of Gyration (y)" InternalName="aa06d9ee-cc07-4fe1-bf9e-79f0b59daedd" Mnemonic="gyrrady"/><CategoryParameter DisplayName="Shape Width" InternalName="b7006b8d-6f00-45d1-a452-689ab1b3c7a6" Mnemonic="shpwdth"/><CategoryParameter DisplayName="Shape Thickness" InternalName="dcf0c9b0-87f2-4f0d-91cf-e765ff163147" Mnemonic="shpthick"/></Category></Category><Category DisplayName="DataType" InternalName="23b78d0f-2648-40c6-8793-ca6db495c9e8" Mnemonic="DATATYPE"><CategoryParameter DisplayName="DisplayName" InternalName="05415f3d-3907-474b-a020-eb9d644f4cf3" Mnemonic="DISPLAYNAME"/><CategoryParameter DisplayName="InternalName" InternalName="cf1d0246-76d9-4b4a-8305-fa0409afb5c1" Mnemonic="INTERNALNAME"/><CategoryParameter DisplayName="Folder Name" InternalName="3f06958e-8713-4116-9be7-ed6184ecc97b" Mnemonic="FOLDERNAME"/><CategoryParameter DisplayName="Family Version" InternalName="914462f6-6e19-4b14-ba84-155b9680b1d0" Mnemonic="FAMILYREVISION"/><CategoryParameter DisplayName="ClipFormat" InternalName="bc51e27b-3422-4e78-93ef-cec197ddf230" Mnemonic="CLIPFORMAT"/><CategoryParameter DisplayName="IsMetric" InternalName="e2385c5b-1ea4-4823-96a8-8de651266ec3" Mnemonic="ISMETRIC"/><CategoryParameter DisplayName="Description" InternalName="13903e3d-64b1-4950-80da-f627842ea37f" Mnemonic="DESCRIPTION"/><CategoryParameter DisplayName="StdsOrg" InternalName="8f5914e1-4693-403f-8ab5-d37768198c9d" Mnemonic="STDSORG"/><CategoryParameter DisplayName="Standard" InternalName="0c0a119c-1e12-4c84-803f-101930972f5e" Mnemonic="STANDARD"/><CategoryParameter DisplayName="Manufacturer" InternalName="cd6c7a72-a28a-4e50-99a9-2c7f4e13e5ad" Mnemonic="MANUFACTURER"/><CategoryParameter DisplayName="Member Revision" InternalName="a65d44b9-392f-4f4f-857b-e4b3d54996fe" Mnemonic="MEMBERREVISION"/><CategoryParameter DisplayName="Standard Revision" InternalName="91d5a463-65c2-4fde-b823-3b7fea5e8e17" Mnemonic="STANDARDREVISION"/><CategoryParameter DisplayName="Revision Guid" InternalName="45a75005-10b1-4dfc-8d6d-dfe629f0b93c" Mnemonic="REVISIONGUID"/><CategoryParameter DisplayName="Designation" InternalName="2675968c-4ce5-49e0-a4f5-552d29089031" Mnemonic="DESIGNATION"/><CategoryParameter DisplayName="FileName" InternalName="8b46a4cc-9585-4fed-90c3-899f57e09a73" Mnemonic="FILENAME"/><CategoryParameter DisplayName="Default Row" InternalName="2af9ec52-faaa-4026-b378-f9fa4afca842" Mnemonic="DEFAULTROW"/><Category DisplayName="Part" InternalName="c0e0b642-3bcb-4cc8-9e80-f96d35c4afa4" Mnemonic="PART"><CategoryParameter DisplayName="Material" InternalName="818a152a-d3c3-49ca-80ee-df7d91421b8e" Mnemonic="MATERIAL"/><CategoryParameter DisplayName="Material Key" InternalName="5c9a8adb-dd2b-4535-b97f-0a94a95fe41f" Mnemonic="MATERIALKEY"/><CategoryParameter DisplayName="Part Number" InternalName="016b6077-bfbe-49bd-92c9-d8d59c39c941" Mnemonic="PARTNUMBER"/><CategoryParameter DisplayName="Stock Number" InternalName="4dba7c1c-e26c-444e-836c-b08b433409a8" Mnemonic="STOCKNUMBER"/></Category></Category></Categories><FamilyTemplate Id="SQ 1 x 1 - 12 Lg"><FamilyTemplateParameters><FamilyTemplateParameter ObjectType="kUserParameterObject" ValueType="xs:double" Id="1" ObjectReferenceKey="B_L"/><FamilyTemplateParameter ObjectType="kUserParameterObject" ValueType="xs:double" Id="3" ObjectReferenceKey="t"/><FamilyTemplateParameter ObjectType="kUserParameterObject" ValueType="xs:double" Id="4" ObjectReferenceKey="w"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="18" ObjectReferenceKey="{32853F0F-3444-11d1-9E93-0060B03C1CA6}" SubObjectId="5"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="19" ObjectReferenceKey="{32853F0F-3444-11d1-9E93-0060B03C1CA6}" SubObjectId="52"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="20" ObjectReferenceKey="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" SubObjectId="t"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="21" ObjectReferenceKey="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" SubObjectId="w"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="23" ObjectReferenceKey="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" SubObjectId="NAME"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="24" ObjectReferenceKey="{32853F0F-3444-11D1-9E93-0060B03C1CA6}" SubObjectId="55"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="25" ObjectReferenceKey="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" SubObjectId="MAS"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="26" ObjectReferenceKey="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" SubObjectId="SHAPE"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="27" ObjectReferenceKey="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" SubObjectId="AREA"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="28" ObjectReferenceKey="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" SubObjectId="Beta"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="29" ObjectReferenceKey="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" SubObjectId="Jk"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="30" ObjectReferenceKey="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" SubObjectId="Wk"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="31" ObjectReferenceKey="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" SubObjectId="Sx"/><FamilyTemplateParameter ObjectType="kPropertyObject" ValueType="xs:string" Id="32" ObjectReferenceKey="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" SubObjectId="Ix"/><FamilyTemplateParameter ObjectType="kPartComponentDefinitionObject" ValueType="xs:string" Id="35" SubObjectId="Material"/></FamilyTemplateParameters></FamilyTemplate><CategoryParameterMap><ParamToTemplateMap><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='cf1d0246-76d9-4b4a-8305-fa0409afb5c1']" ConstantValue="5ec52d67-1f8d-4188-8a87-6673e5ea5583"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='45a75005-10b1-4dfc-8d6d-dfe629f0b93c']" ConstantValue="dc66418f-63fb-4cf3-96d7-3859f94e8cc7"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='3f06958e-8713-4116-9be7-ed6184ecc97b']" ConstantValue="AISC SQ"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='8f5914e1-4693-403f-8ab5-d37768198c9d']" ConstantValue="AISC"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='0c0a119c-1e12-4c84-803f-101930972f5e']" ConstantValue="AISC"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='91d5a463-65c2-4fde-b823-3b7fea5e8e17']" ConstantValue="2003"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='cd6c7a72-a28a-4e50-99a9-2c7f4e13e5ad']" ConstantValue="Ryerson"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='13903e3d-64b1-4950-80da-f627842ea37f']" ConstantValue="Squares"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='05415f3d-3907-474b-a020-eb9d644f4cf3']" ConstantValue="AISC SQ"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='914462f6-6e19-4b14-ba84-155b9680b1d0']" ConstantValue="11"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='bc51e27b-3422-4e78-93ef-cec197ddf230']" ConstantValue="CF_INVENTOR.STDPARTS"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='e2385c5b-1ea4-4823-96a8-8de651266ec3']" ConstantValue="false"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='2af9ec52-faaa-4026-b378-f9fa4afca842']" ConstantValue="1"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='9c666724-f362-4ea7-ac62-f6a007de5c69']" ConstantValue="1"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='8b46a4cc-9585-4fed-90c3-899f57e09a73']" ConstantValue="SQ 3 1/2 x 3 1/2 - 12 Lg"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='a65d44b9-392f-4f4f-857b-e4b3d54996fe']" ConstantValue="15203b8f-ff35-469e-9a77-0d0763f1e028"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='5a64d034-428d-49c8-ba32-7619764de20f']" ConstantValue="SQ 3 1/2 x 3 1/2"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='a65d44b9-392f-4f4f-857b-e4b3d54996fe']" ConstantValue="15203b8f-ff35-469e-9a77-0d0763f1e028"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='1ff91680-64b0-4202-b9a3-7fd3f94bba3b']" TemplateParameter="27"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='42e34263-8f20-4d0e-ad48-bf1385b87c24']" TemplateParameter="1"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='de4c90c6-aaa8-468f-a335-6737b311b5d3']" TemplateParameter="28"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='2675968c-4ce5-49e0-a4f5-552d29089031']" TemplateParameter="19"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='4cd780bc-73d7-43ac-917a-579e5cbd684d']" TemplateParameter="32"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='26c1ec35-5026-4c63-ad0a-751cf684a536']" TemplateParameter="29"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='0bb95a10-148f-4027-a459-38d7b056702a']" TemplateParameter="25"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='818a152a-d3c3-49ca-80ee-df7d91421b8e']" TemplateParameter="35"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='016b6077-bfbe-49bd-92c9-d8d59c39c941']" TemplateParameter="18"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='72cfad18-cf51-4ed4-aaa7-c6b224f8419f']" TemplateParameter="31"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='7c55a8dc-8844-49f9-a867-cc677b30ec9a']" TemplateParameter="30"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='d109cf76-8eb4-42fc-9800-4409734adc67']" TemplateParameter="20"/><ParamToTemplate CategoryParameter="//CategoryParameter[@InternalName='7c717d54-a18f-4666-b4d4-573cce22c62c']" TemplateParameter="21"/></ParamToTemplateMap></CategoryParameterMap></MemberInstance>

Stock Number --> 01
Weld Material --> 
Mass --> 4067.xxx-xxxxxxxx
SurfaceArea --> 2912.8974
Volume --> 6122.616787
Density --> 0.664318
Valid MassProps --> 31
Flat Pattern Width --> 0
Flat Pattern Length --> 0
Flat Pattern Area --> 0
Sheet Metal Rule --> 
Sheet Metal Width --> 
Sheet Metal Length --> 
Sheet Metal Area --> 

Inventor Summary Information:

Title --> 
Subject --> 
Author --> TP
Keywords --> 
Comments --> 4x4
Last Saved By --> 
Revision Number --> 

Inventor Document Summary Information:

Category --> Post
Manager --> 
Company --> 

Inventor User Defined Properties:

G_D1 --> BD
MAS --> 41.6745
NAME --> BD 4x4 - 30 1/2 Lg
G_W --> 3 1/2
SA --> 2912.8974cm^2
t --> 3 1/2
w --> 3 1/2
G_T --> 3 1/2
G_L --> 30 1/2
B_L --> 36
AREA --> 12.25
Beta --> 1.77
Jk --> 18.7578125
SHAPE --> BD
Sx --> 5.359375
Wk --> 10.71875
Ix --> 9.37890625
Manufacturing Notes -->  
G_H --> 3.500 in
TYPE --> Post
MARK --> 01
SIZE --> 4x4
... 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 63 of 72

NachoShaw
Advisor
Advisor

Hey

 

The PropertySetExists is in the API help

NachitoMax_0-1633352566853.png

NachitoMax_0-1633352717995.png

 

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 64 of 72

cadman777
Advisor
Advisor

Thanks for that info.

But if you go back to my previous post, I show you my VBA that doesn't have that Member in PropertySets, which is why it errorred out on me when I ran it. You can see what I had to do to get the rule to run (in the below post). All the commented out lines are your original code. So I wonder how to to check if my older CC parts even have a property to i.d. them as CC parts? I posted the property dump below to show you what one of those members has. But I don't know which property may be the CC identifier. Maybe you can tell me?'

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 65 of 72

NachoShaw
Advisor
Advisor

Hey

 

check this link

 

https://adndevblog.typepad.com/manufacturing/2012/06/determine-whether-a-part-is-a-content-center-pa...

 

from 2011 onward, you can use PartComponentDefinition.IsContentMember which is a boolean member. you could access like This

Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oAsmDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition
Dim oLeafOccs As ComponentOccurrencesEnumerator = oAsmDef.Occurrences.AllLeafOccurrences

For Each oOcc As ComponentOccurrence in oLeafOccs
   Dim oDoc As PartDocument = oOcc.Document
   Dim oDef As PartComponentDefinition = oDoc.Definition
   Dim IsCC As Boolean = oDef.IsContentMember

   Select Case IsCC
      Case True
         'Do something here because its a CC part
      Case Else
         'Do something else because its not a CC part
   End Select
Next

 

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 66 of 72

cadman777
Advisor
Advisor

Thanx!

Let's see how it works...

... 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 67 of 72

Stakin
Collaborator
Collaborator

This sample can link the parameter from Part1 to Part2.

 part1.ipt: has two userparameters,named “Dia” and "height"

 part2.ipt, has two userparameters,named “Dia01” and "height01"

 

 run the code link the part1's parameter to part2, and set the

Dia01=Dia

height01=height

 

Before Running code,the part1

Stakin_0-1633498249477.png

Before running code ,the part2

Stakin_1-1633498895937.png

and After run the code in the part2, the part2 change to as below

Stakin_2-1633499057909.png

Dim oDoc As PartDocument
Dim oRefDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
oRefDoc = ThisApplication.Documents.Open("C:\test\Part1.ipt",False)

Dim oDocDef As PartComponentDefinition
Dim oRefDocDef As PartComponentDefinition
oDocDef = oDoc.ComponentDefinition
oRefDocDef = oRefDoc.ComponentDefinition
Dim oDocDerivedPara As DerivedParameter
Dim oDocDerivedParaTable As DerivedParameterTable
Dim oParamsToLink As ObjectCollection
    oParamsToLink = ThisApplication.TransientObjects.CreateObjectCollection
	For Each oUserPara As UserParameter In oRefDocDef.Parameters.UserParameters
   	 oParamsToLink.Add(oUserPara)
	Next
oDocDerivedParaTable = oDocDef.Parameters.DerivedParameterTables.Add2("C:\test\Part1.ipt", oParamsToLink)
oParamsToLink.Clear
oRefDoc.Close
oDocDerivedPara=oDocDerivedParaTable.DerivedParameters.Item("Dia")
Dim oPara As UserParameter
oPara = oDocDef.Parameters.UserParameters.Item("Dia01")
oPara.Expression = oDocDerivedPara.Name
oDocDerivedPara = oDocDerivedParaTable.DerivedParameters.Item("height")
oPara = oDocDef.Parameters.UserParameters.Item("height01")
oPara.Expression = oDocDerivedPara.Name

oDoc.Update

 

 

and after u change the Part1's parameter ,the part2 will change either.

change the Dia=100mm

height=20mm

Stakin_3-1633499458773.png

and then open the part2, and update;

Stakin_4-1633499592991.png

 

 

 

 

0 Likes
Message 68 of 72

cadman777
Advisor
Advisor

@Stakin 

This is exactly what I want to do!

One caveat:
All parts have the same Parameter name, so when I derive a Parameter if the same name, the derived Parameter name adds "_1" suffix (Inventor built-in procedure).

The reason it happens is b/c the Parameter name already exists in the part template.

Example: Part 1 and Part 2 have same Parameter "G_D".

When Part 2 derives G_D into Part 1 the derived parameter becomes "G_D_1" (or _2 or _3, depending if other parameters of the same name are already derived into that part).

Anyway, let me try it and see how it works.

The important thing is, I see how you coded it.

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 69 of 72

Stakin
Collaborator
Collaborator

 

 

 

Sub main
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
Dim oSourceRefPrt2Name As String
oSourceRefPrt2Name = "E:\2021WorkStation\OutRuleDIR\ParaMeter\Part1.ipt"
Dim oSourceParaName1 As String
Dim oSourceParaName2 As String
oSourceParaName1 = "Dia"
oSourceParaName2 = "height"
Dim oTargetParaName1 As String
Dim oTargetParaName2 As String
oTargetParaName1 = "Dia"
oTargetParaName2 = "height"
Call oLinkPrt1ParaToPrt2(oDoc, oSourceRefPrt2Name, oSourceParaName1, oSourceParaName2, oTargetParaName1, oTargetParaName2)

End Sub
Private Function oLinkPrt1ParaToPrt2(oDoc As PartDocument,oSourceRefPrt2Name As String,oTargetParaName1 As String,oTargetParaName2 As String,oSourceParaName1 As String,oSourceParaName2 As String)
Dim oDocDef As PartComponentDefinition
oDocDef = oDoc.ComponentDefinition
Dim oRefDoc As PartDocument
oRefDoc = ThisApplication.Documents.Open(oSourceRefPrt2Name,False)
Dim oRefDocDef As PartComponentDefinition
oRefDocDef = oRefDoc.ComponentDefinition

Dim oPara1 As UserParameter
Dim oPara2 As UserParameter
Try
	oPara1 = oDocDef.Parameters.UserParameters.Item(oTargetParaName1)
	oPara2 = oDocDef.Parameters.UserParameters.Item(oTargetParaName2)
Catch
	MessageBox.Show("No<" & oTargetParaName1 & "> Or <"  & oTargetParaName2 & "> Parameter In the target File", "Message")
	Exit Function
End Try
Dim oPara21 As UserParameter
Dim oPara22 As UserParameter
Try
	oPara21 = oRefDocDef.Parameters.UserParameters.Item(oSourceParaName1)
	oPara22 = oRefDocDef.Parameters.UserParameters.Item(oSourceParaName2)
Catch
	MessageBox.Show("No<" & oSourceParaName1 & "> Or <" & oSourceParaName2 & "> Parameter In the Source File", "Message")
	Exit Function
End Try


Dim oDocDerivedPara1 As DerivedParameter
Dim oDocDerivedPara2 As DerivedParameter
Dim oDocDerivedParaTable As DerivedParameterTable

Dim oParamsToLink As ObjectCollection
Dim oLinkOrNot As Boolean =True

For Each oDocDerivedParaTable In oDocDef.Parameters.DerivedParameterTables
	If oDocDerivedParaTable.ReferencedDocumentDescriptor.FullDocumentName = oRefDoc.FullFileName Then
		oLinkOrNot = False
		Exit For
	End If	
Next
If oLinkOrNot Then
    oParamsToLink = ThisApplication.TransientObjects.CreateObjectCollection
	oParamsToLink.Add(oPara21)
	oParamsToLink.Add(oPara22)	
	oDocDerivedParaTable = oDocDef.Parameters.DerivedParameterTables.Add2(oRefDoc.FullFileName, oParamsToLink)
	oParamsToLink.Clear
	oRefDoc.Close
End If


Try
	oDocDerivedPara1=oDocDerivedParaTable.DerivedParameters.Item(oSourceParaName1)
Catch
	oDocDerivedPara1=oDocDerivedParaTable.DerivedParameters.Item(oSourceParaName1 & "_1")
End Try

Try
	oDocDerivedPara2=oDocDerivedParaTable.DerivedParameters.Item(oSourceParaName2)
Catch
	oDocDerivedPara2=oDocDerivedParaTable.DerivedParameters.Item(oSourceParaName2 & "_1")
End Try

oPara1.Expression = oDocDerivedPara1.Name
oPara2.Expression = oDocDerivedPara2.Name

oDoc.Update
End Function

 

 

 

No matter the the parameter name is same or not, this rule can handle them . 

0 Likes
Message 70 of 72

cadman777
Advisor
Advisor

Thanx for popping out this for me!

Tomorrow when I have time I'll look at it and see how it works.

I already tried modifying your other rule, but didn't have enough time to get anywhere with it.

This rule shows me there's way more to modifying the rule to do the new stuff than I thought.

Anyway, thanx for your help!

... 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 71 of 72

Stakin
Collaborator
Collaborator

The current parameter linking scheme can only run the program once. Another way is to only use the parameter values in the source file without linking them, but it must be run every time when the parameters in the source file changed.

 

0 Likes
Message 72 of 72

wmgshurik
Enthusiast
Enthusiast

That is +/- from API help c#

 

PartDocument partDoc = InvApp.ActiveEditDocument as PartDocument;

//check null

 

string path = @"D:\****.ipt";

//check exist

PartDocument oSourceDoc = InvApp.Documents.Open(path, false) as PartDocument;


ObjectCollection oParamsToLink = InvApp.TransientObjects.CreateObjectCollection();

//Check parameters are present!

oParamsToLink.Add(oSourceDoc.ComponentDefinition.Parameters["ContourWidth"]);
oParamsToLink.Add(oSourceDoc.ComponentDefinition.Parameters["ContourHeight"]);

 

DerivedParameterTable oDerivedParamTable = partDoc.ComponentDefinition.Parameters.DerivedParameterTables.Add2(path, oParamsToLink);

 

//if paramsToLink changed - once more time
//oDerivedParamTable.LinkedParameters = oParamsToLink;

0 Likes