Jump to content

Recommended Posts

Posted

I searched but didn't find anything.

 

I have a drawing with several different dimension styles that have the alternate units turned on and the are displayed in Millimeters, now the Architect would like them Displayed in Meters.

 

I can't figure out how to change the dimension style with the corrected info. I have to update about 100 drawings with at least 3 dim styles in each drawing. I know I can change it using Dimstyle, but I'd rather automate the process if I can.

 

I need to modify the existing dimstyle without using dim overrides.

 

thanks for your help.

Posted

Try this mate:

 

(defun c:alt (/ doc)
 (vl-load-com)
 (vlax-for dim (vla-get-Dimstyles
                 (setq doc
                   (vla-get-ActiveDocument
                     (vlax-get-acad-object))))
   (vla-put-activeDimstyle doc dim)
   (setvar "DIMALTF" 0.001)
   (vla-copyfrom dim doc))
 (princ))

Posted

not sure how to setup this one? loaded it, typed alt but didn't see it do anything.

Posted
not sure how to setup this one? loaded it, typed alt but didn't see it do anything.

 

Check your dim styles.

Posted

I see it created a few new ones,

 

What I'm looking to do is modify the existing ones to new settings, without having to do each one individually.

Posted
I see it created a few new ones,

 

What I'm looking to do is modify the existing ones to new settings, without having to do each one individually.

 

It shouldn't have created anything :huh:

Posted

sorry, that was from the other lisp, before filling in my layers. :oops:

 

what is it suppose to do?

Posted
It shouldn't have created anything :huh:

 

I like that Lee. It changed the Alt Units Multiplier. Thats great.

Posted

Its supposed to do what you requested it to do... :wink:

 

Changes the Alternative Units Multiplier to 0.001 to convert mm to m.

Posted
Its supposed to do what you requested it to do... :wink:

 

Changes the Alternative Units Multiplier to 0.001 to convert mm to m.

Lee,

 

I would assume that only will apply to the current dimstyle?

Posted

I just found out its changing in all dimstyles current or not, Not sure if thats a good idea.

Posted
I just found out its changing in all dimstyles current or not, Not sure if thats a good idea.

 

Well, that is what was requested. :wink:

Posted
Well, that is what was requested. :wink:

 

Ok, But if you were using a drawing with multiple viewports with different scales, You might not want to change all of them.

 

Just a thought.

Posted

what I have to change in the dimstyle is the following

 

Multiplier for alt untis: 25.4 to .02540

Suffix: from MM to M

 

this sets the dimstyle to display correctly once I save it.

 

is there a way to just change those on specific dim styles?

Posted
what I have to change in the dimstyle is the following

 

Multiplier for alt untis: 25.4 to .02540

Suffix: from MM to M

 

this sets the dimstyle to display correctly once I save it.

 

is there a way to just change those on specific dim styles?

 

yes, but none of this was specified in the OP... :unsure:

Posted
yes, but none of this was specified in the OP... :unsure:

 

 

sorry I wasn't very clear in my OP, I can see that it would work, but it seems I would have to manually update the dims, as they don't automatically update when the change is made.

Posted

Try to explain the whole problem next time, but this should sort you:

 

(defun c:alt (/ dimlst doc ss)
 (vl-load-com)

 (setq dimlst '("DIM_STYL1" "DIM_STYL2")) ;; Change as necessary
 
 (vlax-for dim (vla-get-Dimstyles
                 (setq doc
                   (vla-get-ActiveDocument
                     (vlax-get-acad-object))))
   (if (vl-position (vla-get-Name dim) dimlst)
     (progn
       (vla-put-activeDimstyle doc dim)
       (setvar "DIMALTF" 0.02540)
       (setvar "DIMAPOST" "M")
       (vla-copyfrom dim doc))))

 (if (setq ss (ssget "_X" '((0 . "DIMENSION"))))
   (mapcar 'vla-update
     (mapcar 'vlax-ename->vla-object
       (mapcar 'cadr (ssnamex ss)))))
 
 (princ))

 

Update list as necessary.

  • Like 1
Posted

Thank you, that works perfect. You are the man flex.gif

Posted
Thank you, that works perfect. You are the man flex.gif

 

Haha thanks :)

 

love da smiley :)

Posted

sometimes trying to figure out these lisp things I really feel like the computer it really taking to me. lamo.gif

 

but once I get them working, usually with others help it sure is nice. biggrin.gif

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...