Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Auto Ordinate to 0 instead of .00 or .000 or .0000 on sheet. illogic code.

0 REPLIES 0
Reply
Message 1 of 1
maxim.teleguz
72 Views, 0 Replies

Auto Ordinate to 0 instead of .00 or .000 or .0000 on sheet. illogic code.

the code also keeps any custom text in your ordinate dimension.


Imports Inventor
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
Imports System
Imports System.Windows.Forms
Imports System.Text.RegularExpressions
AddReference "System.Drawing.dll"
AddReference "System.Xml.dll"

'Dim oDoc As DrawingDocument
'oDoc = ThisApplication.ActiveDocument

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView

'Define the drawing dims collection
Dim oDrawingDims As DrawingDimension
On Error Resume Next

'Loop through all dimensions and replace the zero with precision to just zero
For Each oView In oSheet.DrawingViews
	For Each oDrawingDims In oDoc.ActiveSheet.DrawingDimensions
   
   		' Use regex to check if the text contains patterns like ".00" or "2X .00" without digits directly before the dot
   		If Regex.IsMatch(oDrawingDims.Text.Text, "(^|\D)\.[0]+(\D|$)") Then
	   		'oDrawingDims.HideValue = True
	   		'oDrawingDims.Text.FormattedText = "0"
			oDrawingDims.Precision = 0
   		End If
		
		'Use Origin Indicator - DrawingOrdinateDimensionUseOriginIndicatorCtxCmd
		'Hide Origin Indicator - DrawingOrdinateHoleOriginIndicatorCtxCmd
		
	Next
Next
'Next

SendKeys.SendWait("{ESC}")
AppActivate(ThisApplication.Caption)
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report