Jump to content

Change a dimension from fractional to decimal (3 places) with a suffix


Recommended Posts

Posted (edited)

I have a lisp that makes several dimensions. I need to know how I can convert some of them(not all) into decimal format with 3 decimal places with an " suffix at the end.

 

If somebody can tell me the exact command and syntax I would use for that that would be great

 

Oh and another thing, how would I change the dim style of some dimensions that I made in lisp? (not through AutoCAD, in LISP)

Edited by KendiKong
Posted
I have a lisp that makes several dimensions. I need to know how I can convert some of them(not all) into decimal format with 3 decimal places with an " suffix at the end.

 

If somebody can tell me the exact command and syntax I would use for that that would be great

 

Oh and another thing, how would I change the dim style of some dimensions that I made in lisp?

Do a vlax-dump of all the dimension information, the necessary information is all in there. I use Lee Mac's lisp routine to do dump the information http://lee-mac.com/dumpobject.html. All you will need to do is use the vla-put functions.
Posted

Not exactly what I need. Its pretty simple. I just need to the autolisp syntax for converting dimension to decimal with a suffix: "

Posted

Learning how to do a dump and examine the information will help you accomplish this (if you look at the dump or go the acadauto.chm file it will tell you how to accomplish it). Learning how to use the vla functions (and where the information is stored) will be immensely helpful for learning how to write LISP routines.

Posted

Well I'm still a beginner at lisp, so I'll try taking a look at this some time, but for now I would just like to know how to change a regular dimension property to decimal with this suffix: "

Posted

1)Use ssget to have the user select only dimensions (look at Lee's reference for the ssget function found here: http://lee-mac.com/ssget.html)

2)Make use of a repeat function where you convert the selection set to a vla-object using vlax-ename->vla-object.

3)Within the repeat function use vla-put-stylename function because I would recommend just creating another style that has the everything set that you want because this is a better CAD practice.

4)You will want to use either the vla-put-TextOverride or the vla-put-textsuffix functions to put a suffix.

5)Close the repeat function

Posted

Being a beginner myself, I run this code:

 

(defun c:deci ()
 (setvar "dimpost" "<>\"")
 (setvar "dimlunit" 2)
 (setvar "dimdec" 3)
 (princ)
)

 

Then I go to Dimension menu > Update and select all the dimensions I want to change.

Posted

Why not just create that as a child Dimension style then select the Dimensions to change to that style?

Posted

Try this

 

(while (setq obj (entsel))
(setvar "dimdec" 3)
(command "-dimstyle" "a" obj "")
)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...