Change sheet metal rule on a solid body with iLogic

Change sheet metal rule on a solid body with iLogic

Anonymous
Not applicable
6,669 Views
62 Replies
Message 1 of 63

Change sheet metal rule on a solid body with iLogic

Anonymous
Not applicable

Hello ,

 

Does anyone knows, if it is possible to set the sheet metal rule for a solid body in a Multi-body sheet metal?

You can set a different sheet metal rule for each solid body. So is it possible with ilogic to create a rule,

if this parameter = 5mm, then set sheet metal rule for a specific solid body? So, when the parameter change to

another value, you don't have to reset manualy the sheet metal rule for this specific solid body...

 

thx in advance!

Accepted solutions (1)
6,670 Views
62 Replies
Replies (62)
Message 2 of 63

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Try below iLogic code to set sheet metal rule for specific surface body.

Sub Main()
    Dim oDoc As PartDocument
    oDoc = ThisApplication.ActiveDocument
    
    Dim oDef As SheetMetalComponentDefinition
    oDef = oDoc.ComponentDefinition
    
    Dim oBody As SurfaceBody
    oBody = oDef.SurfaceBodies.Item(1)
    
    Dim oStyle As SheetMetalStyle
    oStyle = oDef.SheetMetalStyles.Item(1)
    Call oDef.SetBodySheetMetalStyle(oBody, oStyle)
End Sub

Thanks and regards,

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 63

Anonymous
Not applicable

@chandra.shekar.g

First of all, thank you for helping me out on this topic!

This is works like it should.

Only one more question on this, is it possible to reference to body names and sheet metal style names?

Now we have like 100 different types of plates, and there is always a possibility that we add a new one to the list,

so if we do then we have to change item (x) to item (y) in our code. if we can give a style name, we don't have that 

problem anymore. The same with the solid body name, if  we add a new solid between, this can give a problem i think...

 

I don't know if it's even possible, but i tought the changing of the sheet metal rule wasn't possible olso 🙂

My iLogic experience is still at te very beginning...

 

Thx advance!

Kind regards

0 Likes
Message 4 of 63

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Adding and updating of new sheet metal rule name and body name may not possible to synchronize. Creation of new body requires either manual update or running iLogic code.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 5 of 63

Anonymous
Not applicable

@chandra.shekar.g

Thx for you reply!

 

What i mean is if it's possible to change the reference in de code 

oDef.SurfaceBodies.Item(1) to the name of the solid body "Plate Left"

oDef.SheetMetalStyles.Item(1) to the name of the sheet metal rule "Laserform S235JR 005"

 

Now it refence to the position of the solid body in the model three

and the position of the sheet metal rule in our sheet metal styles list

 

Thx in advance!

 

0 Likes
Message 6 of 63

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Anonymous,

 

Try below iLogic code to get solid body and sheet metal rule with specified name.

    Dim oDoc As PartDocument
    oDoc = ThisApplication.ActiveDocument
    
    Dim oDef As SheetMetalComponentDefinition
    oDef = oDoc.ComponentDefinition
    
    Dim oBody As SurfaceBody
    For Each oBody In oDef.SurfaceBodies
        If oBody.Name = "Plate Left" Then
            Exit For
        End If
    Next
    
    Dim oStyle As SheetMetalStyle
    For Each oStyle In oDef.SheetMetalStyles
        If oStyle.Name = "Laserform S235JR 005" Then
            Exit For
        End If
    Next
     
    If Not oStyle Is Nothing And Not oBody Is Nothing Then
        Call oDef.SetBodySheetMetalStyle(oBody, oStyle)
    End If

Thanks and regards,

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 7 of 63

Anonymous
Not applicable

@chandra.shekar.g

This is exact what we wanted!

Thx for your help and quick reply's!

 

Kind Regards,

Niels

0 Likes
Message 8 of 63

Anonymous
Not applicable

@chandra.shekar.g

I've made 2 rules to change the sheet metal rule for 2 different solid bodies.

When i change the thickness for one of the bodies, the rules work fine, but when i change the 

thickness for both solid bodies at once, then i get an error on my rules.

I can't figure out why, since this works fine when i only change the thickness for one of the bodies...

i've attached a screencast and a file with the rules i use, and with the error i get.

Can u help me out on this?

If you have other questions or need more info, let me know.

thx in advance!

 

0 Likes
Message 9 of 63

Anonymous
Not applicable

@chandra.shekar.g

These are both files.

When i've changed a thickness, and i use the update command, then i get an error also,

but when i use the save command, then i don't get this error. do i have to add something additional to my rules to avoid this?

 

Thx in advance!

0 Likes
Message 10 of 63

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Actually, SchetspartTrog1.ipt needs update on changing parameter in Doorsnede400.ipt. Try below iLogic code in SchetspartTrog1.ipt. Rule works, but geometrical error is there in SchetspartTrog1.ipt on updating parameter.

Sub Main() 

Dim oDoc As PartDocument 

oDoc = ThisApplication.ActiveDocument 

Call oDoc.Update()

Dim oDef As SheetMetalComponentDefinition 

oDef = oDoc.ComponentDefinition 

Dim oBody As SurfaceBody 

For Each oBody In oDef.SurfaceBodies
	
	If oBody.Name = "Dekplaat 1" Then
    
	Exit For
    
	End If

	Next

Dim oStyle As SheetMetalStyle 

Select Case DikteDekplaat

Case 2
			For Each oStyle In oDef.SheetMetalStyles
    
			If oStyle.Name = "PLAAT KGW 002 S235JR" Then
    
			Exit For
    
			End If
    
			Next
Case 3
			For Each oStyle In oDef.SheetMetalStyles
    
			If oStyle.Name = "PLAAT 003 LASERFORM S235JR" Then
    
			Exit For
    
			End If
    
			Next
Case 4
			For Each oStyle In oDef.SheetMetalStyles
    
			If oStyle.Name = "PLAAT 004 LASERFORM S235JR" Then
    
			Exit For
    
			End If
    
			Next
Case 5
			For Each oStyle In oDef.SheetMetalStyles
    
			If oStyle.Name = "PLAAT 005 LASERFORM S235JR" Then
    
			Exit For
    
			End If
    
			Next
			
Case 6
			For Each oStyle In oDef.SheetMetalStyles
    
			If oStyle.Name = "PLAAT 006 LASERFORM S235JR" Then
    
			Exit For
    
			End If
    
			Next
Case 8
			For Each oStyle In oDef.SheetMetalStyles
    
			If oStyle.Name = "PLAAT 008 LASERFORM S235JR" Then
    
			Exit For
    
			End If
    
			Next
End Select
	
	 If Not oStyle Is Nothing And Not oBody Is Nothing Then
        
	Call oDef.SetBodySheetMetalStyle(oBody, oStyle)
    
	End If 
End Sub

Thanks and regards, 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 11 of 63

Anonymous
Not applicable

@chandra.shekar.g

I added the update command to my code, but i've still got the same errors...

When i change one of these parameters marked in red in Doorsnede400.ipt at the time, and then save SchetspartTrog1 instead of using the local update command, i have no errors.

But when i change both of these parameters marked in red in Doorsnede400.ipt at the same time, and then save

SchetspartTrog1 (again, not using the local update command), then i have an error.

 

Why does it works fine when i only change one of these parameters, but not when i change more then one parameter at the same time?

 

And why does i get an error when i use the local update command (When only changing one parameter), and no error when saving SchetspartTrog1 instead? This is less important, since it works fine when i use the save command instead.

 

If you need more information or details, let me know!

 

Thx in advance!

image.png

0 Likes
Message 12 of 63

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

On updating through UI, there is error in SchetspartTrog1.ipt file as shown below. If this error is resolved, then update command will work in iLogic rule.

 

Update_Error.PNG

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 13 of 63

Anonymous
Not applicable

@chandra.shekar.g

hello,

i explained my problem in an audio video, so i hope now you can see what i mean.

Everything works fine when i only change 1 parameter at the time, but when i want to change both of them

at te same time, it doesn't. I olso would like it to work in that case.

 

i would olso like to have the same outcome like i am saving the file (no error message), when i use the local update command. now inventor first shows the error message. when saving the file instead, no errors appear.

 

If you need more info, or anything else, please let me know.

 

thx in advance!

0 Likes
Message 14 of 63

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

 

Can you please specify video link or video file?

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 15 of 63

Anonymous
Not applicable

@chandra.shekar.g

https://knowledge.autodesk.com/community/screencast/8aa695a3-9a73-43eb-9e5f-d622e2683d20

This is the video link.

Normally i added this in the section PAST A SCREENCAST URL. If it isn't there, i did something wrong i guess...

Let me know if you still can't see my video.

 

Thx

0 Likes
Message 16 of 63

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

In both files, only 3 sheet metal rules are defined namely "PLAAT KGW 002 S235JR" , "PLAAT 003 LASERFORM S235JR" and "PLAAT 004 LASERFORM S235JR" as shown in below image. Other sheet metal rules ("PLAAT 005 LASERFORM S235JR", "PLAAT 006 LASERFORM S235JR" and "PLAAT 008 LASERFORM S235JR" )are not defined.

 

Sheet metal rule.PNG

 

Can you please resolve geometrical error which is appearing on update command as shown below?Update_Error.PNG

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 17 of 63

Anonymous
Not applicable

@chandra.shekar.g

Hello,

I added the sheet metal rules to the documents, so please find in the attachement the new files.

I also made a new video.

 

https://knowledge.autodesk.com/community/screencast/e2c3a548-47a4-44b5-9dfe-5f705b9ecac4

 

The geometrical error appear because the sheet metal rules for the ''zijplaat" and the ''dekplaat" aren't updated correctly with my rules i've made. This only appears when we change the thickness for both solid bodies.

When we only change the tickness for one solid bodie at the time, the sheet metal rule for the specific solid bodie updates correct.

If you need anything else, or more info about something, let me know.

 

Thx in advance!

0 Likes
Message 18 of 63

JBerns
Advisor
Advisor

@Anonymous,

 

What programming language and controls did you use to create the interface with expandable sections?

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes
Message 19 of 63

Anonymous
Not applicable

@JBerns

I used ilogic within Inventor to create my rules and forms. For the expandable sections, i used Group from the toolbox in the FormEditor.

Form.png

0 Likes
Message 20 of 63

JBerns
Advisor
Advisor

@Anonymous,

 

Thanks for the quick reply. I too used the Group tool, but the interface appears with + and - symbols instead of the drop-down arrows.

2018-12-10_9-32-50.png

 

I thought you may have found a new interface tool. Perhaps it is an Operating System difference.

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes