Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
nicolamora
475 Views, 2 Replies

VBA code to unflag "USE THICKNESS FROM RULE"

I need a VBA code to unflag the "Use Thickness from Rule" in the sheet metal style property.

I tried the "ThisDoc.Document.ComponentDefinition.UseSheetMetalStyleThickness = False" but give me a debug error.

 

Also the following code:

Sub ChangeUseThicknessFromRule()
  Dim doc As PartDocument
  Set doc = ThisApplication.ActiveDocument
  
  Dim cd As SheetMetalComponentDefinition
  Set cd = doc.ComponentDefinition
  
  cd.UseSheetMetalStyleThickness = False
End Sub

 Not sure where is the error.

Thanks,

Nicola

Hi, I have created a metal sheet file and the code that you have created works, it does not show any error. Could you attach your example here to investigate?

 

Sub ChangeUseThicknessFromRule()
  Dim doc As PartDocument
  Set doc = ThisApplication.ActiveDocument
  
  Dim cd As SheetMetalComponentDefinition
  Set cd = doc.ComponentDefinition
  
  cd.UseSheetMetalStyleThickness = False
End Sub

 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

I was trying to use the code on an old derived sheet metal part, and it didn't work.

But it works perfectly on new parts. 

I'm guessing the problem was just that.

 

Thanks anyway for your fast reply,

Nicola