set origin for all ordinate dimensions

set origin for all ordinate dimensions

Anonymous
Not applicable
15,933 Views
18 Replies
Message 1 of 19

set origin for all ordinate dimensions

Anonymous
Not applicable

Hi all,

I want to set a new origin for all ordinate dimensions at once. I know I can choose the grip & move it but each dimension has a different origin so it would take a long time...is there some lisp routine that can do this?????

Thanks!

0 Likes
Accepted solutions (1)
15,934 Views
18 Replies
Replies (18)
Message 2 of 19

wispoxy
Advisor
Advisor

Setting the AutoCAD Ordinate Dimension Origin

 

AutoCAD ordinate dimensions are used for many reasons.  The main one is to decrease the amount of dimensional clutter that can result when a large number of linear dimensions are used in the view.  Users are often frustrated because the placed ordinate dimensions do not relate to the model origin.  In the drawing below, it obvious the ordinate dimensions are incorrect because the model is 5 units, in both X and Y directions, from the origin of the drawing.

Blog1

Most users understand this but wonder how to move the origin to the required location.  Some would think the best way to accomplish this is to move the model to the origin.  This would work but it is often not desirable to move the model.  The best way is to move and align the origin to the model.  There are two AutoCAD commands that handle this task easily.  If the model is aligned with the X and Y axis, use the UCS "Origin" command.  In AutoCAD 2016, this command is found under the "Visualize" tab, "Coordinates" panel.

Blog2

The command prompts you to select the new drawing origin point.  Use Object Snap Tracking to place the origin at the intersection of the left and bottom edges.

Blog3

When placing ordinate dimensions, the dimensions values read as expected.

Blog4

The UCS (User Coordinate System) has a lot more uses especially to simplify the drawing process.  Give it a try.

0 Likes
Message 3 of 19

wispoxy
Advisor
Advisor
Now a routine to to this to all of them would be awesome.
0 Likes
Message 4 of 19

dbroad
Mentor
Mentor

So you want a routine to enable bad dimensioning practice.  There is really no reason why every ordinate dimension would have a different origin.  I can't imagine any drafter doing that more than once.  

 

Without programming a solution, qselect all the ordinate dimensions.  The grip(s) that aren't at the ordinate dimension can be dragged to the new location (together, not individually). I would be surprised if they were scattered all over the place.  Ordinate dimension origins always are located at the ucs origin current during dimension placement.  Takes about 10 seconds usually.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 5 of 19

Anonymous
Not applicable
Hi, So let me explain myself a little better: I have a block that contains an ordinate dimension which I place in various places on my drawing - what I want to do is explode all these blocks & place all the origin points of the dimensions that are now have to my UCS ORIGIN point - not going one by one & moving the grip. & yes, each one has a different origin because it was set inside the block... thanks for your help
0 Likes
Message 6 of 19

ВeekeeCZ
Consultant
Consultant

Try this... It works for pre-selected selection set, or for all ordinate dims if nothing is preselected.

 

(defun c:DOOrigin ( / ss pt i ed)
   
  (if (and (setq ss (cond ((ssget "_I" '((0 . "DIMENSION"))))
			  ((ssget "_A" '((0 . "DIMENSION"))))))
	   (setq pt (getpoint "\nNew origin: "))
	   (setq pt (trans pt 1 0))
	   )
    (repeat (setq i (sslength ss))
      (setq ed (entget (ssname ss (setq i (1- i)))))      
      (foreach e ed
	(if (and (= (car e) 100)
		 (wcmatch (cdr e) "*Ordinate*"))
	  (entmod (subst (cons 10 pt)
			 (assoc 10 ed)
			 ed))))))
  (sssetfirst nil nil)
  (princ)
)

 

 

0 Likes
Message 7 of 19

wispoxy
Advisor
Advisor

I don't understand. People spend hours looking for a LISP code yet I could've completed what they wanted like five times by mouse clicking before they get an answer.

... My excuse: For future projects.

0 Likes
Message 8 of 19

Anonymous
Not applicable

Thanks BeeKeeCZ ! thants PERFECT!! thank you SO much - it's excatly what I was looking for, you just my office hours of work 🙂

0 Likes
Message 9 of 19

ВeekeeCZ
Consultant
Consultant
@Anonymous wrote:

Sorry , My English is not good
As I do not yet know how to code properly in LISP
I really like your LISP.
Can help me increase  
Number after being executed ?
thank you very much!!!  Smiley Happy

 

Sorry, would you try to explain what you mean by "increase number after being executed?"

And please do not use a PM for this kind of request...

 

0 Likes
Message 10 of 19

Anonymous
Not applicable

This PM requests help behavior
It seems to be bad here.
May be cultural differences

Sorry, Not clear
I have no intention of offending.

Need to a new post to forums?

0 Likes
Message 11 of 19

ВeekeeCZ
Consultant
Consultant

@Anonymous wrote:

This PM requests help behavior
It seems to be bad here.
May be cultural differences

Sorry, Not clear
I have no intention of offending.

Need to a new post to forums?


 

Don't worry about that. Just try better explain your issue.

0 Likes
Message 12 of 19

Anonymous
Not applicable

Picture explanation:
Thank.

Snap6.png

0 Likes
Message 13 of 19

ВeekeeCZ
Consultant
Consultant
Accepted solution

Nice explanation! This makes sense, it was easy enough.

 

;; BeekeeCZ 2018-11-16

(defun c:DOOrigin ( / ss pt i ed n)  ; Dim Ordinate Origin set
   
  ; routine is appliead on pre-selected selection set
  ; or to all Ordinate dimensions in the drawing
  
  (if (and (setq ss (cond ((ssget "_I" '((0 . "DIMENSION"))))
			  ((ssget "_A" (list '(0 . "DIMENSION") (cons 410 (getvar 'CTAB)))))))
	   (setq pt (getpoint "\nNew origin: "))
	   (setq pt (trans pt 1 0))
           (setq n 0)
	   )
    (repeat (setq i (sslength ss))
      (setq ed (entget (ssname ss (setq i (1- i)))))      
      (foreach e ed
	(if (and (= (car e) 100)
		 (wcmatch (cdr e) "*Ordinate*")
                 (setq n (1+ n)))
	  (entmod (subst (cons 10 pt)
			 (assoc 10 ed)
			 ed))))))
  (sssetfirst nil nil)
  (if (> n 0) (princ (strcat "\n" (itoa n) " ordinate dimentions modified.")))
  (princ)
)

(princ "\nType 'DOOrigin' to run the command. Applied on the Pre-Selection OR on ALL Ordinate Dims.")
(princ)
Message 14 of 19

Anonymous
Not applicable

Thank  BeekeeCZ

I need very much, is great.Smiley Very Happy

0 Likes
Message 15 of 19

SES_AsRe
Contributor
Contributor
Hi, I know this post is over three years old, but I just found it right now :).
For me it doesn`t work as it should. I mean you can set a new origin for all selected (or all) ordinate dimensions, but the values doesn`t update.
For example the dimension has 50 and I set a new origin, the value is still 50, also the origin is new.
So I have to pick the origin again and click to the desired origin and now the value updates.
How can I improve this code so I get the updated value after using this LISP?
Thanks to all.
0 Likes
Message 16 of 19

ВeekeeCZ
Consultant
Consultant

Rascher,

start with posting a dwg with an example of your situation.

0 Likes
Message 17 of 19

SES_AsRe
Contributor
Contributor

wow, that was fast. I attached an example file.

example.jpg

As you can see, in the middle square the dimensions have the wrong values?

I just saw, when I copy this square including the dimensions, they update and have the right values (right square)

If it helps - I use Autocad Mechanical 2018...

 

Thanks again

 

0 Likes
Message 18 of 19

ВeekeeCZ
Consultant
Consultant

I have no idea what's wrong - looking at dim definition and it seems all good.

Besides, the routine works flawlessly on my side (have C3d).

Very likely it has something to do with Mechanical... Can't tell.

 

Anyway, try this modified version. It dose the same thing but using different functions.

 

(defun c:DOOrigin ( / ss pt i ed n)  ; Dim Ordinate Origin set
   
  ; routine is appliead on pre-selected selection set
  ; or to all Ordinate dimensions in the drawing
  
  (if (and (setq ss (cond ((ssget "_I" '((0 . "DIMENSION"))))
			  ((ssget "_A" (list '(0 . "DIMENSION") (cons 410 (getvar 'CTAB)))))))
	   (setq pt (getpoint "\nNew origin: "))
	   (setq pt (trans pt 1 0))
           (setq n 0)
	   )
    (repeat (setq i (sslength ss))
      (setq ed (entget (setq d (ssname ss (setq i (1- i))))))
      (foreach e ed
	(if (and (= (car e) 100)
		 (wcmatch (cdr e) "*Ordinate*")
                 (setq n (1+ n)))
	  (progn
	    (setpropertyvalue d "Origin/X" (car pt))
	    (setpropertyvalue d "Origin/Y" (cadr pt))
	    (setpropertyvalue d "Origin/Z" (caddr pt)))))))

  (sssetfirst nil nil)
  (if (> n 0) (princ (strcat "\n" (itoa n) " ordinate dimentions modified.")))
  (princ)
)

(princ "\nType 'DOOrigin' to run the command. Applied on the Pre-Selection OR on ALL Ordinate Dims.")
(princ)

 

Message 19 of 19

SES_AsRe
Contributor
Contributor

Hello again,

 

thank you 🙂 - this one works perfect and makes my working day really much more easier.

 

0 Likes