Undo Material override for Sheet Metal back to 'By Sheet Metal Rule'.

Undo Material override for Sheet Metal back to 'By Sheet Metal Rule'.

checkcheck_master
Advocate Advocate
420 Views
3 Replies
Message 1 of 4

Undo Material override for Sheet Metal back to 'By Sheet Metal Rule'.

checkcheck_master
Advocate
Advocate

We have a separate sheet metal rule for every material and sheet thickness combination.
I see here and there that this is described as a good method.
In our sheet metal templates, material is listed as 'By Sheet Metal Rule'.
So far no problems until material is controlled via the BOM.
Then in fact a material override takes place with the possible consequence that different materials occur in a one part file which can sometimes be confusing, which one is meant?

I would like to know how I can use iLogic to undo the override and set it back to 'By Sheet Metal Rule'.

 

Are there perhaps better methods than described above.
I now use a rule 'Set Sheet Metal' from Luke Davenport to provide multiple parts of another sheet metal rule in an assembly.
Although the rule does its job well, nice piece of code by the way, we still prefer to be able to change the material from within the BOM.
How should we best set up the sheet metal rules in that case?

0 Likes
Accepted solutions (1)
421 Views
3 Replies
Replies (3)
Message 2 of 4

dalton98
Collaborator
Collaborator
Accepted solution

If I'm understanding correctly...

You change the material in the assembly BOM but you don't change the sheet metal rule/ parameter. Then you want to change the material back to match the sheet metal rule/parameter?

 

The easiest solution I could think of would be to just not save the assembly file and have it reset automatically.

 

The ilogic solution is this:

Dim oAss As AssemblyDocument = ThisApplication.ActiveDocument
Dim oDoc as Document
For Each oDoc In oAss.AllReferencedDocuments
Try
Dim oSMCompDef As SheetMetalComponentDefinition
oSMCompDef = oDoc.ComponentDefinition

oSMCompDef.UseSheetMetalStyleMaterial = True
Catch
End Try Next
0 Likes
Message 3 of 4

checkcheck_master
Advocate
Advocate

 

Thank you very much, exactly what I was looking for.
Had already searched the API help on 'Sheet Metal' but didn't see it, afterwards it was among the 329 search results.

 

I believe that I should now also be able to answer my second question: What do we need to be able to use the BoM to change the material?
We need a rule that determines whether Material corresponds to Sheet Metal Rule Material and otherwise, based on Material and Thickness, looks in the Sheet Metal rules which rule corresponds to this with a message when a Sheet Metal Rule is missing and needs to be created or else.
Does such a thing already exist?
All tips are more than welcome, what should I pay attention to?
Thanks in advance.

0 Likes
Message 4 of 4

dalton98
Collaborator
Collaborator

@checkcheck_master I couldn't find anything on changing a sheet metal rule's material from the api help. The closest thing was a 'Sheet Metal Style Creation' vba rule. They may have removed this feature.

 

You might want to create a new post asking if this is possible.

 

But as far as checking if a part's material and thickness match a sheet metal default this should be simple enough, but idk how to create a new sheet metal style with a default material.

I would set it up like this:

1. create a list with all sheet metal defaults you use

2. check all parts in assembly for material and thickness, compare to list

3. if no match is found add that specific combo to a new list

4. print new list of new sheet metal defaults

 

0 Likes