Weldment appearance

Weldment appearance

rafael.barata
Enthusiast Enthusiast
221 Views
6 Replies
Message 1 of 7

Weldment appearance

rafael.barata
Enthusiast
Enthusiast

Hello everyone,

 

May I ask for your help to create an iLogic rule? Something like this:

 

  • For each weldment in the assembly, or respective children (weldments only), read their specific weld appearance and force it as appearance property on those documents, so I can have it in BOM.

rafaelbarata_0-1748948051131.png

 

rafaelbarata_1-1748948134448.png

 

0 Likes
Accepted solutions (1)
222 Views
6 Replies
Replies (6)
Message 2 of 7

WCrihfield
Mentor
Mentor

Hi @rafael.barata.  Generally speaking, assemblies do not have a 'material' or an 'appearance' of their own.  They just represent the 'components' that we place into them.  Because of this,  the main iProperty named "Appearance" for an assembly document will not be meaningful.  In regular (not weldment) assemblies, there is only one thing that we can control the material of, and that is 'virtual' components, which have no visual representation anyways, and are just for adding custom rows into our BOM.  Then, when we have a weldment type assembly, we can additionally set the 'material' to use for the weld beads.  And yes, it does allow us set an override appearance for those weld beads, other than the weld bead material's own appearance.  But setting that is not the same as the main material or appearance for the overall assembly document though, just for the welds that get created within the assembly, if any.  There is actually a standard iProperty named "Weld Material" in the PropertySet named "Design Tracking Properties", which is the third PropertySet, and that property is item # 38 of its properties.  It has a String type value, but for most other types of documents, it will not have a value.  There is no iProperty for weld appearance though.  So, I'm not sure if what you are attempting to do is possible.

Those controls in the quick access toolbar for material and appearance drop-downs generally only show something meaningful when we have something within the assembly selected, as a convenience.  I do know how to set the material and appearance of weld beads within a weldment type assembly, but doubt that it would make any difference to anything within the BOM of a parent assembly.

Edit:  Attached is a text file containing code that can be used for an example iLogic rule.  That rule is designed to be ran while the 'main' (highest level) assembly is the 'active' document and/or the rule is saved within that assembly, then it will iterate through all of the documents being referenced at all levels within that assembly, find the ones that are weldment assemblies, and attempt to set the appearance of their weld beads to the one shown in your screen captured image.  Again, I am not sure if that will actually accomplish what you were hoping it would accomplish, but it is at least somewhere to start exploring / testing.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 7

rafael.barata
Enthusiast
Enthusiast

Hi @WCrihfield,

 

First of all, thank you for your answer and sorry the late reply.

Until AI2023, there was a bug that allowed to assign an appearance to weldment assemblies (only) in BOM environment. This bug allowed me to use the appearance property of parts and weld assemblies in .idw's legend title block to place the finishing that I wanted (Black oxide, paint, brushed, polished, etc...). It was a rule of thumb to assign the same appearance of the weld beads to the BOM property.

 

Since the bug was corrected in AI2024, in order to not invalidate every .idw that were made before and also to not create a new way of work for every designer in my firm, I need to force that property so I can still use it in legend title blocks. in a main assembly, i would run that rule and it will search every weld assemblies inside and force that appearance. Is that possible.

 

I also place here an excerpt of an answer from Johnson Shiue, when I asked him for help.

 

"Many thanks for sharing the 2023 files! I did confirm the behavior you are seeing. The issue here is that the Appearance style seems to have a unique behavior in BOM table. It seems to be the only way to change the “Appearance style” and also the style isn’t used anywhere visually except being the “Appearance” property shown in the drawing or BOM table.

This legacy behavior is somewhat corruptive, prone to have problems. It is why it is blocked in 2024 to prevent more corruptions.

I don’t think there is a good solution here. An iLogic rule might help “bypass” the behavior in 2024. For example, simply create an iLogic rule in the top-level assembly. Add the following statement. The Appearance property will be changed to Aluminum Casting.

 

iProperties.Value("22053AI-AS15-000:1", "Project", "Appearance")="Aluminum Casting""                                                                     "

 

Hope you can help me.

 

Best regards,

Rafael Barata

0 Likes
Message 4 of 7

WCrihfield
Mentor
Mentor

OK, well if he says it is possible, I will have to take his word for it, but the online help documentation says otherwise.  What I mean is, each of the first 4 PropertySets in every Document, and a special PropertySet only present in 'Content Center' stuff, has an 'Enum' for them.  There are online help pages for each of those Enums.  I will post those links below, for reference:

PropertiesForSummaryInformationEnum 

PropertiesForDocSummaryInformationEnum 

PropertiesForDesignTrackingPropertiesEnum 

PropertiesForUserDefinedPropertiesEnum 

PropertiesForContentLibraryEnum 

The standard Property named 'Appearance' is at the Index position of 53 in the third PropertySet, the one named "Design Tracking Properties".  When we look at the Enum for that PropertySet, and look at the line item for the Property named 'Appearance' (first one shown, due to alphabetical order), it says that it is ReadOnly, and says that it there is no user interface access to it.  That online help documentation may simply be outdated, and needs to be updated (hint @johnsonshiue).  When I use a line of code to set the value of that iProperty, I do not get an error, but that also does not really set the Appearance of that Document, in the traditional sense.  I believe that Property's value gets set automatically by Inventor when we set the 'real' appearance (an Asset object) of a Document, so its value gets driven by that action, not the other way around.  But if setting the value of that iProperty is all that is needed in your case, then that would certainly simplify things greatly.

Below is an updated code example using that process, but doing it the Inventor API way, instead of the iLogic API way, to help clarify document specification when dealing with referenced documents in the background.  This can be used directly on a weldment type assembly, or used from a parent level assembly containing some weldment type sub components.

Dim oADoc As AssemblyDocument = TryCast(ThisDoc.Document, Inventor.AssemblyDocument)
If oADoc Is Nothing Then Return
If TypeOf oADoc.ComponentDefinition Is WeldmentComponentDefinition Then
	oADoc.PropertySets.Item(3).Item(53).Value = "Decapage"
End If
For Each oRefDoc As Inventor.Document In oADoc.AllReferencedDocuments
	If Not TypeOf oRefDoc Is Inventor.AssemblyDocument Then Continue For
	Dim oRefADoc As AssemblyDocument = oRefDoc
	If Not TypeOf oRefADoc.ComponentDefinition Is WeldmentComponentDefinition Then Continue For
	oRefADoc.PropertySets.Item(3).Item(53).Value = "Decapage"
Next
oADoc.Update2(True)

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 7

rafael.barata
Enthusiast
Enthusiast

Once again, thank you for your answer. Your code works perfect. That's almost what I want. I ask you if you may make just one slight modification.

 

Instead of forcing the value, in this case, "Decapage", can you read the appearance of the welding bead, of each Weldment assembly, and use it as value for oRefADoc.PropertySets.Item(3).Item(53).Value?

 

The rest is perfect. It shows the value in BOM and I also can use it in idw's title block.

0 Likes
Message 6 of 7

WCrihfield
Mentor
Mentor
Accepted solution

Sure.  Here you go.  I broke this one down into two parts again, to simplify it even further, and make it slightly more dynamic/efficient.

Sub Main
	Dim oDoc As Inventor.Document = ThisDoc.Document
	SetWeldAppearanceAsDocAppearance(oDoc)
	For Each oRefDoc As Inventor.Document In oDoc.AllReferencedDocuments
		SetWeldAppearanceAsDocAppearance(oRefDoc)
	Next
	oDoc.Update2(True)
End Sub

Sub SetWeldAppearanceAsDocAppearance(doc As Inventor.Document)
	If Not TypeOf doc Is Inventor.AssemblyDocument Then Return
	Dim oADoc As AssemblyDocument = doc
	If Not TypeOf oADoc.ComponentDefinition Is WeldmentComponentDefinition Then Return
	Dim oWDef As WeldmentComponentDefinition = oADoc.ComponentDefinition
	oADoc.PropertySets.Item(3).Item(53).Value = oWDef.WeldBeadAppearance.DisplayName
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

EESignature

(Not an Autodesk Employee)

Message 7 of 7

rafael.barata
Enthusiast
Enthusiast

Hi,

It's perfect. Problem solved. Many thanks.

0 Likes