Hi @jcloutierMQ36F. This can be a very confusing topic to ask questions about, so using correct terms/words and being as clear as possible is important. I just want to make sure what the phrase "in derived part from the base component" means.
Scenario 1: If you have a Part document open on your screen right now (the active document), and some 'other' part is derived into this active document, then are you wanting to be able to get the material and stock number from that 'other' part (the one that is derived into this part)?
Scenario 2: If you have a Part document open on your screen right now (the active document), and this document is derived into some 'other' Part document, and you want to be able to get the material and stock number from the other Part document that this Part document is derived into?
Scenario 1 may be possible, but Scenario 2 would normally not be possible, but may be possible to achieve in certain special situations.
Wesley Crihfield
(Not an Autodesk Employee)
The scenario 1 is exactly the case I wanted to explain, sorry for confusion.
I am wanting to get material, stock number and maby other innformation that are not parameters from derived part and use them into the active part.
In this specific case, I derived a part created by the frame generator into a new one that I want to modify. It works properly but I want the material and stock number to be updated if changes are done in the frame.
OK. Since you want these things to stay updated when the original model changes, I do not believe this would be possible. I may be able to access those things within the document that is being derived into this part, and I may be able to 'copy' their 'static' values into the active document, but I do not know of any way to include those things as part of the 'derive in' process/definition, so that they would stay 'linked'. There is currently no built-in way to include iProperties or Material in the Derive Part definition. When the original part was designed as sheet metal, and the part it is being derived into was also created as sheet metal, then there is an option to "Link Sheet Metal Styles", but I am not familiar enough with that setting to know if that will cause the very specific behavior of [if only the Material in original changes, that will automatically change only the material in the part that it is derived into].
Here is some iLogic rule code you can play around with which shows hot to access a lot of those types of settings, just for future reference.
Sub Main
Dim oPDoc As PartDocument = TryCast(ThisDoc.Document, Inventor.PartDocument)
If oPDoc Is Nothing Then Return
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
'check to see if there are any Parts (DerivedPartComponents) derived into this document
Dim oDPCs As DerivedPartComponents = oPDef.ReferenceComponents.DerivedPartComponents
If oDPCs.Count = 0 Then
Logger.Info("No DerivedPartComponents found in this PartDocument.")
Return
End If
'<<< access the settings of the existing 'Derive Part' >>>
'get just the first one (it is possible to have more than one)
Dim oDPC As DerivedPartComponent = oDPCs.Item(1)
'Log some of its direct settings
Logger.Info("DerivedPartComponent HealthStatus = " & oDPC.HealthStatus.ToString)
Logger.Info("DerivedPartComponent IsEmbedded = " & oDPC.IsEmbedded)
Logger.Info("DerivedPartComponent LinkedToFile = " & oDPC.LinkedToFile)
Logger.Info("DerivedPartComponent Name = " & oDPC.Name)
Logger.Info("DerivedPartComponent SuppressLinkToFile = " & oDPC.SuppressLinkToFile)
'get its 'Definition'
Dim oDPDef As DerivedPartDefinition = oDPC.Definition
'Log some of the Definition direct settings
Logger.Info("Derive Style = " & oDPDef.DeriveStyle.ToString)
Logger.Info("ActiveDesignViewRepresentation = " & oDPDef.ActiveDesignViewRepresentation)
Logger.Info("IsAssociativeDesignView = " & oDPDef.IsAssociativeDesignView)
Logger.Info("ActiveModelState = " & oDPDef.ActiveModelState)
Logger.Info("LinkFaceColorFromSource = " & oDPDef.LinkFaceColorFromSource)
Try : Logger.Info("LinkSheetMetalStyles = " & oDPDef.LinkSheetMetalStyles) : Catch : End Try
Logger.Info("LinkSketchFormattingFromSource = " & oDPDef.LinkSketchFormattingFromSource)
Logger.Info("ReducedMemoryMode = " & oDPDef.ReducedMemoryMode)
Logger.Info("UseOrientedMinimumBoundingBox = " & oDPDef.UseOrientedMinimumBoundingBox)
'find out which more specific type of DerivedPartDefinition this is, to access more specific stuff
If TypeOf oDPDef Is DerivedPartCoordinateSystemDef Then
Dim oDPCSDef As DerivedPartCoordinateSystemDef = oDPDef
'access to more specific stuff
ElseIf TypeOf oDPDef Is DerivedPartTransformDef Then
Dim oDPTDef As DerivedPartTransformDef = oDPDef
'access to more specific stuff
ElseIf TypeOf oDPDef Is DerivedPartUniformScaleDef Then
Dim oDPUSDef As DerivedPartUniformScaleDef = oDPDef
'access to more specific stuff
Logger.Info("ScaleFactor = " & oDPUSDef.ScaleFactor)
End If
'access the actual Document & File of the part derived into this document
Dim sFDN As String = oDPC.ReferencedDocumentDescriptor.FullDocumentName
Logger.Info("Derived-In FullDocumentName = " & sFDN)
Dim oDerivedInPartFile As Inventor.File = oDPC.ReferencedDocumentDescriptor.ReferencedFileDescriptor.ReferencedFile
Dim oDerivedInPartDoc As PartDocument = oDPC.ReferencedDocumentDescriptor.ReferencedDocument
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield
(Not an Autodesk Employee)
Can't find what you're looking for? Ask the community or share your knowledge.