Chamfer default note Change via vba

Chamfer default note Change via vba

k14348
Advocate Advocate
735 Views
4 Replies
Message 1 of 5

Chamfer default note Change via vba

k14348
Advocate
Advocate

Hi,

 i want to change the default Chamfer note via Vba . Anybody can help?

Reference image attached.

 

-karthikeyan M

0 Likes
736 Views
4 Replies
Replies (4)
Message 2 of 5

frederic.vandenplas
Collaborator
Collaborator

Hi,

 

I suggest you make change in the style editor, save the changes to your global style manager en then run this code

Public Sub ChangeStyle()
    
    Dim oDrawDoc As DrawingDocument
    Set oDrawDoc = ThisApplication.ActiveDocument
    Dim oSheet As Sheet
    Set oSheet = oDrawDoc.ActiveSheet
    Dim oChamferNote As ChamferNote
    Dim oDimStyle As DimensionStyle
    'change the style in the dim style editor first and change name if needed
    Set oDimStyle = oDrawDoc.StylesManager.DimensionStyles("Default (ISO)")
    
    For Each oChamferNote In oSheet.DrawingNotes.ChamferNotes
        oChamferNote.DimensionStyle = oDimStyle
    Next oChamferNote
    
End Sub
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 3 of 5

k14348
Advocate
Advocate

Hi,

   i don't have old drawings to modify notes.So this program will not be useful for me. However thanks for your effort. What i want is ;

i Have a company template which we can't do any modifications  in templates. after open a new drawing i want to change chamfer notes by editing Dimension style-Notes and leader text box(See attached image). Instead of doing this manual i need to do this via vba. I hope now u might understand my question properly.

 

-karthikeyan M

0 Likes
Message 4 of 5

frederic.vandenplas
Collaborator
Collaborator

Hi,

 

Ok, so try in your case this:

Public Sub CreateBalloon()
    
    Dim oDrawDoc As DrawingDocument
    Set oDrawDoc = ThisApplication.ActiveDocument
    Dim oSheet As Sheet
    Set oSheet = oDrawDoc.ActiveSheet
    Dim oChamferNote As ChamferNote
    
    For Each oChamferNote In oSheet.DrawingNotes.ChamferNotes
    oChamferNote.FormattedChamferNote = "CH.<DIST1> X <ANGL>"
    Next oChamferNote
    
End S
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 5 of 5

k14348
Advocate
Advocate

Hi,

 My values are not constant. i have 20 notes in one drawing approx. 19 were already updated. last one i want to create chamfer notes in this case all notes will be replaced if i run ur rule. Please refer my attachment.

 

 

-karthikeyan M

0 Likes