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: 

To Copy View Label Format with also the Text Size

1 REPLY 1
SOLVED
Reply
Message 1 of 2
RoyWickrama_RWEI
339 Views, 1 Reply

To Copy View Label Format with also the Text Size

2019-12-28 19_48_40-Window.png

 

I am using the rule from the forum. Thanks to the forum.

It is fine, but I don't get the TEXT SIZE updated to look similar to the text size of the reference label.

 

I look forward  to receiving help. Thanks.

 

Sub Main
' get app obj
oApp = ThisApplication
'get document obj
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument

' define where to start if selection was not a view label obj
Reselect1:
Dim oObj1 As Object
' prompt user to select a view label to copy
oObj1 = oApp.CommandManager.Pick(kAllEntitiesFilter, "Select View Label to Copy")
' if user presses escape, then oObj1 gets set to Nothing
' test if the user pressed ESC
If oObj1 Is Nothing Then
    Exit Sub
' if the selected obj is NOT a view label then goto Reselect1:
ElseIf Not TypeOf oObj1 Is DrawingViewLabel Then
    GoTo Reselect1
End If
Dim oView1 As DrawingViewLabel
oView1 = oObj1
MessageBox.Show("OK. You selected a view label! " & oObj1.Text, "Title")

Dim oLabel_Ref As DrawingViewLabel
oLabel_Ref = oObj1
' get formatted text from label
Dim oFormattedText_RefLabel As String
oFormattedText_RefLabel = oLabel_Ref.FormattedText

' define where to start if second selection was not a drawing view obj
Reselect2:
Dim oObj2 As Object
oObj2 = oApp.CommandManager.Pick(kAllEntitiesFilter, "Select the Destination View to Copy to")
' if user presses escape, then oObj gets set to Nothing
' test if user pressed ESC
If oObj2 Is Nothing Then
    Exit Sub
' if user selects another sheet, go to that sheet then goto Reselect2:
ElseIf TypeOf oObj2 Is Sheet Then
    oObj2.Activate
    GoTo Reselect2
' if code gets here then selected obj is not a sheet object.
' If selected object is NOT a view label then goto Reselect2:
ElseIf Not TypeOf oObj2 Is DrawingView Then
    'GoTo Reselect2
'Else
End If

Dim oView2 As DrawingViewLabel
oView2 = oObj2
MessageBox.Show("OK. You selected the Destination view label! " & oObj2.Text, "Title")

Dim oLabel_Destination As DrawingViewLabel
oLabel_Destination = oObj2
' get formatted text from label
Dim oFormattedText_Destination As String
oFormattedText_Destination = oLabel_Destination.FormattedText

'' turn visibility of label on
'oView2.ShowLabel = True
Dim oView As DrawingView
oLabel_Destination.FormattedText = oFormattedText_RefLabel		'oFormattedText_RefLabel
'End If
InventorVb.DocumentUpdate(False)

End Sub
1 REPLY 1
Message 2 of 2

Hi,

You should better update the styles.

Than updated the drawing directly and automatically.

 

Regards

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report