Drawings, Find and Replace Datum target (Datum) and Weld Texts.

Drawings, Find and Replace Datum target (Datum) and Weld Texts.

G.Binl
Advocate Advocate
575 Views
2 Replies
Message 1 of 3

Drawings, Find and Replace Datum target (Datum) and Weld Texts.

G.Binl
Advocate
Advocate

Hello All,

Hope everyone is well.

I got 2 issues to solve at the moment.

1st,

In drawings we use the Datum Target as an identifier to a table on our drawing. that are both manually placed in. 

The datum is not being used as a Datum but more as an a fancy identifier for us. 

Datum Targets have a dimension and a Datum we are trying to do a find and replace of the Datum which is a number. 

Example would be 

GBinl_0-1668788545809.png  to    GBinl_2-1668789419527.png

 

There would be other identifiers that would be in the drawing like this. 3 is what we are after to change and this would be throghout the sheet. so an example would be to change 3.2 to 5.2. i will post the current code i use for find and replacing some text below. 

 

2nd. 

We have a drawing that get converted to B units from A units. We call out many welds with the letter A (unit A) example is W-A001 needs to go to W-B001 as shown now the rub is that we may have 20 sheets of these to change on top we can have a unit C,D ect... Im looking for the  commands to search and change this text. I have the code below that i used. I got it from giants in the coding arena and adjusted it to our needs.  

GBinl_1-1668788968505.png

 

I also want to thank all the people who have written or have had input to this code that truly understand programing. I'm sorry i have forgotten where i originally got this from please note I'm truly grateful. 

 

oDoc = ThisDoc.Document

Dim TXT2Find As String
Dim NewTXT As String

'get user input
TXT2Find = InputBox("Enter Text To Find:", "iLogic", "XXX")
'look for blank value
If TXT2Find ="" Then Exit Sub

NewTXT = InputBox("Enter Text To Replace   '"& TXT2Find _ 
& "'  with.", "iLogic", "****")

For Each oSheet As Sheet In oDoc.Sheets
	'DrawingDatumIdentifierEditCtxCmd 
    For Each oGeneralNote As GeneralNote In oSheet.DrawingNotes.GeneralNotes
		oGeneralNote.FormattedText = oGeneralNote.FormattedText.Replace(TXT2Find,NewTXT)   
    Next    
    
    For Each oLeaderNote As LeaderNote In  oSheet.DrawingNotes.LeaderNotes
		oLeaderNote.FormattedText = oLeaderNote.FormattedText.Replace(TXT2Find,NewTXT)  
    Next
	
	'dddddddddddddddddddddddddd
	
'For Each oSheet In oSheets
    For Each cDim As DrawingDimension In oSheet.DrawingDimensions
       If cDim.Text.FormattedText.Contains(TXT2Find) Then
            cDim.Text.FormattedText = cDim.Text.FormattedText.Replace(TXT2Find, NewTXT)
        End If
	
	'For Each oDrawingDimensionNote As DrawingDimensionNote In oSheet.DrawingNotes.DrawingDimensionNote.DimensionNote
		'oDrawingDimensionNote.FormattedText = oDrawingDimensionNote.FormattedText.Replace(TXT2Find, NewTXT)
	Next
	'Next

	'dddddddddddddddddddddddddddddd
Next

 

 

 

 

0 Likes
576 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @G.Binl.  Does your code find the weld symbols or the datum targets/identifiers?  I could be wrong, but I don't think there are specific objects in the API yet for weld symbols or datum targets/identifiers.  The same goes for revision tags.  There are definitely user interface tools for creating them, and drawing selection filters for selecting them, but I do not think I have ever found those specific types of API objects, or any API methods for creating them yet.  You can find an image of the latest API Object Model at this link.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

G.Binl
Advocate
Advocate

@WCrihfield hi,

No, it does not that's what I'm looking for.  Thanks for the link I will look at it. 

0 Likes