Change text on a dimension.

Change text on a dimension.

Anonymous
Not applicable
871 Views
11 Replies
Message 1 of 12

Change text on a dimension.

Anonymous
Not applicable
Is possible to create a macro that changes the text part of a dimension on a
drawing? (Eg. add a ø sign in front of the value)
Also is it possible to use SendKeys command to show the "Right Click popup"
menu?

Lars
0 Likes
872 Views
11 Replies
Replies (11)
Message 2 of 12

Anonymous
Not applicable
to add the diameter sign don't you just right click on the dimension value
and text it in?

Jesse
0 Likes
Message 3 of 12

Anonymous
Not applicable
Yes we do, but when you create a lot of drawings it would be much faster to
have a macro that adds the sign.
(just to select the dimension and select the macro button, compared to right
click, select the Home button, selekt the correkt sign, then ok.)


"Jesse" skrev i meddelandet
news:E7A4D2F8F5E4838B43371A15F4779345@in.WebX.maYIadrTaRb...
> to add the diameter sign don't you just right click on the dimension value
> and text it in?
>
> Jesse
>
>
0 Likes
Message 4 of 12

Anonymous
Not applicable
Access to drawing dimensions is not currently supported by the API.

-Brian

"Lars Andersson" wrote in message
news:E52963017CAC05BBDD1C8C288830535A@in.WebX.maYIadrTaRb...
> Is possible to create a macro that changes the text part of a dimension on
a
> drawing? (Eg. add a ø sign in front of the value)
> Also is it possible to use SendKeys command to show the "Right Click
popup"
> menu?
>
> Lars
>
>
0 Likes
Message 5 of 12

Anonymous
Not applicable
Hey Lars
Is it not easier to set up a new dimension style called "diameter" with the diameter sign always present & just apply this dimension style as required?
0 Likes
Message 6 of 12

Anonymous
Not applicable
Although it seems impossible it is possible. I wanted exactly the same thing and I worked my way around it:

Public Sub RoundSymbol()
' Set a reference to the select set of the active document.
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument

' Find all selected occurrences and add them to an ObjectCollection.
Dim oDrawingDims() As DrawingDimension
a = 0
Dim i As Long
For i = 1 To oDoc.SelectSet.Count
If Not oDoc.SelectSet.Item(i) Is Nothing Then
If TypeOf oDoc.SelectSet.Item(i) Is DrawingDimension Then
a = a + 1
ReDim Preserve oDrawingDims(0 To a)
Set oDrawingDims(a) = oDoc.SelectSet.Item(i)
End If
End If
Next

For b = 1 To a
oDrawingDims(b).Text.FormattedText = "n <<>>"
Next
End Sub

How it works? Just drag over the drawing selecting dimensions (and other stuff). All dimensions will get the round symbol in front.

It works for Inventor series v9
0 Likes
Message 7 of 12

Anonymous
Not applicable
That's an interresting piece of code Joeri...nicely done! "joeri" wrote in message news:19509139.1093942649680.JavaMail.jive@jiveforum1.autodesk.com... > Although it seems impossible it is possible. I wanted exactly the same thing and I worked my way around it: > > Public Sub RoundSymbol() > ' Set a reference to the select set of the active document. > Dim oDoc As DrawingDocument > Set oDoc = ThisApplication.ActiveDocument > > ' Find all selected occurrences and add them to an ObjectCollection. > Dim oDrawingDims() As DrawingDimension > a = 0 > Dim i As Long > For i = 1 To oDoc.SelectSet.Count > If Not oDoc.SelectSet.Item(i) Is Nothing Then > If TypeOf oDoc.SelectSet.Item(i) Is DrawingDimension Then > a = a + 1 > ReDim Preserve oDrawingDims(0 To a) > Set oDrawingDims(a) = oDoc.SelectSet.Item(i) > End If > End If > Next > > For b = 1 To a > oDrawingDims(b).Text.FormattedText = "n <<>>" > Next > End Sub > > How it works? Just drag over the drawing selecting dimensions (and other stuff). All dimensions will get the round symbol in front. > > It works for Inventor series v9
0 Likes
Message 8 of 12

Anonymous
Not applicable
Joeri, Is it possible to collect 2 lines in an IDW in this manner? Is it possible to use these 2 lines to create a CenterLine (Bisector )? Cheers, Teun "joeri" wrote in message news:19509139.1093942649680.JavaMail.jive@jiveforum1.autodesk.com... > Although it seems impossible it is possible. I wanted exactly the same thing and I worked my way around it: > > Public Sub RoundSymbol() > ' Set a reference to the select set of the active document. > Dim oDoc As DrawingDocument > Set oDoc = ThisApplication.ActiveDocument > > ' Find all selected occurrences and add them to an ObjectCollection. > Dim oDrawingDims() As DrawingDimension > a = 0 > Dim i As Long > For i = 1 To oDoc.SelectSet.Count > If Not oDoc.SelectSet.Item(i) Is Nothing Then > If TypeOf oDoc.SelectSet.Item(i) Is DrawingDimension Then > a = a + 1 > ReDim Preserve oDrawingDims(0 To a) > Set oDrawingDims(a) = oDoc.SelectSet.Item(i) > End If > End If > Next > > For b = 1 To a > oDrawingDims(b).Text.FormattedText = "n <<>>" > Next > End Sub > > How it works? Just drag over the drawing selecting dimensions (and other stuff). All dimensions will get the round symbol in front. > > It works for Inventor series v9
0 Likes
Message 9 of 12

Anonymous
Not applicable
I think it should be possible. You can select anything you want. Just make sure you filter out any objects you don't need. I didn't try it though!
0 Likes
Message 10 of 12

Anonymous
Not applicable
I am having a hard time here... I have tried by modifying your code, and adding the lines (2 in total) to the selection set. But I can't figure out how I can use this SelectionSet to create the Centerline. Any clues? "joeri" wrote in message news:9875937.1093964126716.JavaMail.jive@jiveforum2.autodesk.com... > I think it should be possible. You can select anything you want. Just make sure you filter out any objects you don't need. I didn't try it though!
0 Likes
Message 11 of 12

Anonymous
Not applicable
I tried it myself but I can't get it working either... Too bad!
0 Likes
Message 12 of 12

J.Troquay
Contributor
Contributor

to have the dimension value preserved and just put a ø in front (tested in v2019) use this line instead (rest of code stays the same):


oDrawingDims(b).Text.FormattedText = "ø" & "<DimensionValue/>"
0 Likes