iLogic Set dimension to Layer "By Standard"

iLogic Set dimension to Layer "By Standard"

MairA_DUKA
Enthusiast Enthusiast
1,520 Views
8 Replies
Message 1 of 9

iLogic Set dimension to Layer "By Standard"

MairA_DUKA
Enthusiast
Enthusiast

Hello

 

In an Inventor-Drawing after Stile-Editor-Update some dimensions are not on the correct Layer.

image.png

I want to set all green dimensions on the right Layer.

If I make it manually, I go to select the Layer "By Standard" (in german like "Nach Norm") ...

image.png

and after selection the dimension is on the right Layer.

image.png

In this case "Nach Norm (DIMENSION)" ==> In English "By Standard (DIMENSION)"

 

I have written this iLogic-Rule:

Dim oDoc As DrawingDocument
	oDoc = ThisDoc.Document
	
	If (oDoc.DocumentType = Inventor.DocumentTypeEnum.kDrawingDocumentObject) Then
		If (oDoc.DisplayName = "Symbole.idw") Then
			Exit Sub
		End If
		
		Dim oSheet As Sheet = oDoc.ActiveSheet
		Dim oLayer As Layer = oDoc.StylesManager.Layers.Item("DIMENSION")
		Dim oDim As GeneralDimension
		Dim Count As Integer = 0
		
		For Each oDim In oSheet.DrawingDimensions
			Count = Count + 1
			If (oDim.Layer.Name <> "DIMENSION") Then
				MessageBox.Show(oDim.Layer.Name)
				oDim.Layer = oLayer
			End If
		Next
		MessageBox.Show(Count)
	End If

I will get this result:

image.png

The result for me is not 100% correct, because I want set it to "By Standard (DIMENSION)".

How can I get my wanted result?

Many thanks for your answers.

Accepted solutions (1)
1,521 Views
8 Replies
Replies (8)
Message 2 of 9

tfrohe_LSI
Advocate
Advocate
Accepted solution

@MairA_DUKA 

 

You should be able to set the Layer to Nothing to have it return the the "By Standard" choice

 

oDim.Layer = Nothing

 

Message 3 of 9

engilic
Advocate
Advocate

Hi @MairA_DUKA and @tfrohe_LSI ,

 

this is great solution for Layers.

 

you are my last hope to make same thing for dimension Style

 

oDim.Style = Nothing

 

doesn’t work, or I am doing something wrong 

 

please do you know how to set dimension Style to be By Standard?

 

tried everything, searched everywhere, posted twice in the forum, nothing

 

maybe not possible 

 

thx

0 Likes
Message 4 of 9

MairA_DUKA
Enthusiast
Enthusiast

Hello

You must use this code:

 

Break

Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document

If (oDoc.DocumentType = Inventor.DocumentTypeEnum.kDrawingDocumentObject) Then
	Dim oSheet As Sheet = oDoc.ActiveSheet
	Dim oLayer As Layer = oDoc.StylesManager.Layers.Item("DIMENSION")
	Dim oDim As GeneralDimension
	Dim Count As Integer = 0
	
	For Each oDim In oSheet.DrawingDimensions
		Count += 1
		If (oDim.Layer.Name <> "DIMENSION") Then
'			MessageBox.Show(oDim.Layer.Name)
			oDim.Layer = Nothing
		End If
	Next
	MessageBox.Show(Count)
End If

 

0 Likes
Message 5 of 9

engilic
Advocate
Advocate

thank you @MairA_DUKA ,

 

As I said, this works for Layers but not for Styles.

 

Any solution for Styles?

0 Likes
Message 6 of 9

MairA_DUKA
Enthusiast
Enthusiast

Hello

I can help you with this code.

It sets the style to an other style, but not to "By Standard".

 

Break

Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document

If (oDoc.DocumentType = Inventor.DocumentTypeEnum.kDrawingDocumentObject) Then
	Dim oSheet As Sheet = oDoc.ActiveSheet
	Dim oDim As GeneralDimension
	Dim Count As Integer = 0
	Dim oNewStyle As DimensionStyle = oDoc.StylesManager.DimensionStyles.Item("Bemaßung (WEC)")
	
	For Each oDim In oSheet.DrawingDimensions
		Count += 1
		If (oDim.Style.Name <> "Bemaßung (WEC)") Then
'			MessageBox.Show(oDim.Style.Name)
			oDim.Style = oNewStyle
		End If
	Next
	MessageBox.Show(Count)
End If 

 

0 Likes
Message 7 of 9

engilic
Advocate
Advocate

Thank you @MairA_DUKA ,

 

You really wanna help but I need to set it to "By standard" not to a particular standard.

I have the code to set it to a particular one but do not need that.

It seems no one knows or it cannot be done, and I really need it.

Thank you for your time.

0 Likes
Message 8 of 9

MairA_DUKA
Enthusiast
Enthusiast

Hi

I've tried all the options I know, but none of them worked.

 

Solution 1:

If you have only some dimensions you can select it all in one time and change manually the style to "By standard".

 

Solution 2:

With your Autodesk-Account you can open a support case directly to Autodesk.

In my experience, they will help you quickly and can give you an answer if it is possible to set the dimensionstyle to "By standard" with iLogic.

Message 9 of 9

engilic
Advocate
Advocate

Thank you @MairA_DUKA ,

 

I like option 2.

 

Will try to open a support case, if do not know how will ask you for help.

 

You helped a lot, I just thought its game over and I need to give up from that code, you gave me a hope and at the end that might be the crucial thing.

 

thank you very much

0 Likes