Alt dimension in piping isometrics

aprajapati3C
Advocate
Advocate

Alt dimension in piping isometrics

aprajapati3C
Advocate
Advocate

Piping isometrics are not draw to scale so the valve of the dimensions are edited manually. I some cases i need to have the dimensions in both metric & imperial and its a big task to convert all the values and there are chances of error as well.

Is there a way to link the alternate dimension to the value of the primary dimensions?

0 Likes
Reply
Accepted solutions (2)
997 Views
14 Replies
Replies (14)

pendean
Community Legend
Community Legend
DIMStYLE command has a tab for adding alternates like that, have you tried it? BUT... If you need AutoCAD to be automated in its scale conversions, you have to draw items to scale, 1: ideally.

Why are your isometrics not drawn to scale if I may ask?
0 Likes

dany_rochefort
Collaborator
Collaborator

@aprajapati3C You are drafting in millimeters and you want to convert to feet-inches or vice versa?

0 Likes

dany_rochefort
Collaborator
Collaborator

@pendean Piping runs are too long in most cases for isometric piping runs to be to scale.

0 Likes

pendean
Community Legend
Community Legend
@dany_rochefort I see what you mean, good to know if that is the case.

Kent1Cooper
Consultant
Consultant

Let's say you draw in Imperial/Architectural units and you overrode the text content in a Dimension to say 27', and you want the alternate dimension to be in meters.

Kent1Cooper_0-1679330470134.png

This code [in simplest terms] turns the left one above into the right one, in minimal testing:

 

(defun C:DOAT ; = Dimension Override Alternate Text
  (/ dim txt)
  (setq
    dim (car (entsel))
    txt (getpropertyvalue dim "DimensionText")
  )
  (setpropertyvalue dim "DimensionText"
    (strcat txt " [" (rtos (cvunit (distof txt) "inch" "meter") 2 2) "m]")
  )
)

 

Obviously, if you draw in meters and want the alternate value in feet, or some other combination, aspects of that can be edited to suit.

 

It does not check that you selected a Dimension, or whether the Dimension has override text content, or some other things it could do, but see whether it does what you want in the right situation.

 

If you want to change the overridden, you would need to replace the entire with-alternate text override with just the new without-alternate override, and run the command on that again.

Kent Cooper, AIA

aprajapati3C
Advocate
Advocate

@dany_rochefort  Yes. You are right thats how piping isometrics are done. They are not drawn to scale.

Primary unit will be in mm & i want alternate to be in feet-inches (Architectural)

 

@Kent1Cooper  Tanks for the code but for some reason its not able to recognize the dimension. Maybe i am doing something wrong. I am not very familiar with LISP. I get below message when i select a dimension.

aprajapati_0-1679385419968.png

 

 

0 Likes

Kent1Cooper
Consultant
Consultant

@aprajapati3C wrote:

... for some reason its not able to recognize the dimension. Maybe i am doing something wrong. I am not very familiar with LISP. I get below message when i select a dimension.


Does the selected Dimension have numerical override text?  That's essential -- you can't pick a to-scale true Dimension, which should be handled by way of standard Alternate Units.  If there's no override, the txt variable will be "", and (distof txt) will be nil.  It will also be nil if the override text contains letters or punctuation other than a minus sign.

 

Now that you've revealed what units you're working with, try this:

 

(defun C:DOAT ; = Dimension Override Alternate Text
  (/ dim txt)
  (setq
    dim (car (entsel))
    txt (getpropertyvalue dim "DimensionText")
  )
  (setpropertyvalue dim "DimensionText"
    (strcat txt " [" (rtos (cvunit (distof txt) "millimeter" "inch") 4 4) "]")
  )
)

 

which turns the left one here into the right one:

Kent1Cooper_0-1679398547663.png

That rounds to the nearest 1/16", but you can change the last 4 to use different rounding.  Zero gives you the nearest whole inch:

Kent1Cooper_0-1679399179842.png

 

EDIT:  OR, if you prefer:

  ....
    (strcat txt "\\P[" (rtos (cvunit (distof txt) "millimeter" "inch") 4 0) "]")
  ....

does this:

Kent1Cooper_0-1679406659914.png

Kent Cooper, AIA
0 Likes

dany_rochefort
Collaborator
Collaborator

@aprajapati3C  You are going to have to callout the dimensions you need using dimlinear. Once you got your values, copy and paste them onto your isometric ''not to scale dimensions''.  

 

Set up your alternate untis as follows.  

 

10.png

 

If you are wondering what the value of 0.03937 is; it's = 25.4mm / 1''. Which is how you go about converting mm to imperial using alternate units function. It can also be done using lisp commands as noted here in other comments.

  

0 Likes

Kent1Cooper
Consultant
Consultant
Accepted solution

@dany_rochefort wrote:

.... Set up your alternate untis ....


[Alternate units will have no effect in Dimensions whose text content is overridden with a not-to-scale value.  They need to be added as further override content.]

Kent Cooper, AIA
0 Likes

aprajapati3C
Advocate
Advocate

Thanks @Kent1Cooper that worked perfectly. Can i ask for one more help?

 

Normally we add "\X" after the primary value so the text after that can come down in the next line. With this the dimension line doesn't break. Is it possible to add this as well in the code?

 

aprajapati_0-1679483727331.png

 

0 Likes

Kent1Cooper
Consultant
Consultant

@aprajapati3C wrote:

....

Normally we add "\X" after the primary value so the text after that can come down in the next line. With this the dimension line doesn't break. Is it possible to add this as well in the code?


Change  "\\P["  to  "\\X["  in the EDITed line in Message 8?

Kent Cooper, AIA
0 Likes

aprajapati3C
Advocate
Advocate

Thank @Kent1Cooper 

For some reason if the text oblique angle is negative, the code doesnt work.

 

aprajapati_0-1679563776717.png

 

0 Likes

Kent1Cooper
Consultant
Consultant
Accepted solution

@aprajapati3C wrote:

For some reason if the text oblique angle is negative, the code doesnt work.


That's because the code depends on the text override being convertible to a number that it can calculate the alternate value from, with a (distof) function, which requires that the text consists of only numerical content.

 

When you do something like that with the override text in the Dimension, its content ends up being something like this:

{\Q-30;1700}

for which (distof) returns nil.  The same happens with positive obliquing, if that is done by editing the Dimension's text in that way, and not inherent in the Dimension text.  I suspect that in the "correct" part of your image, the obliquing is in the Text Style definition used in the Dimension Style.  Can you make another Text Style obliqued the other way, for use in Dimensions that need that slant direction?

Kent Cooper, AIA
0 Likes

aprajapati3C
Advocate
Advocate

@Kent1Cooper  Thanks. Appreciate your help.

0 Likes