View Full Version : Custom dimentioning by Lisp
Structo
2016-11-23, 05:51 AM
Hi friends,
any possibilities for only dimension text above selected lines as shown in figure. please have a look.
Thanking you,
Best regards.
Hi friends,
any possibilities for only dimension text above selected lines as shown in figure. please have a look.
Thanking you,
Best regards.
I don't know what you want to do with a lisp routine, but
To have your dimensions look like the picture right, you need to use a different dimension method: dimordinate" setting your UCS at the intended "0,0" origin first.
See attached files.
Hope this helps
Structo
2016-11-23, 04:17 PM
Hi friend,
thank you for response.i dont have to move UCS and some difficulties found while using this command. every time asking origin for each line dimension. i want like 0'-0" instead of 0". lisp routine should be run by following procedure:
1) select the lines
2)Pick origin
3) and develop the dimensions as shown in sample drawing.
Thanks.
Hi friend,
thank you for response.i dont have move UCS and some difficulties found while using this command. every time asking origin for each line dimension. i want like 0'-0" instead of 0". lisp routine should be run by following procedure:
1) select the lines
2)Pick origin
3) and develop the dimensions as shown in sample drawing.
Thanks.
this is probably possible, maybe others can chime in and supply some direction.
I don't have time right now, but if possible I will try some other time.
Structo
2016-11-23, 05:05 PM
friend,
Thank you for response. i look forward for your code.
Thank you.
Hi friend,
thank you for response.i dont have to move UCS and some difficulties found while using this command. every time asking origin for each line dimension. i want like 0'-0" instead of 0". lisp routine should be run by following procedure:
1) select the lines
2)Pick origin
3) and develop the dimensions as shown in sample drawing.
Thanks.
Ok, I had some time to play around with this, I think this will do what you want.
I have made some assumptions, like you will have the dimension style set up and current that you want, which will show the dimensions the way you want, not suppressing leading and trailing zeros etc.
You can change the command "foo" to whatever you want, that will be what you type on the command line.
I have added ";; comments" along side the code to help walk you through what I came up with (I am not a LISP expert, this a basic routine with flaws and all, that experienced coders may laugh at.. he he)
But it does work.
(defun c:foo (/ osm lin pt1 la lr1) ;; defines function "foo" (command) you can change to whatever you'd like, and (/ list of local variables)
(setq osm (getvar "osmode")) ;; records your current running osnaps and sets it equal to "osm"
(setvar "osmode" 1) ;; sets osnaps to endpoint
(setvar "ucsicon" 3) ;; sets your ucsicon to "on" and at origin
(setq lin (ssget)) ;; sets "lin" equal to what you select (you select all the lines you want dimensioned)
(setq pt1 (getpoint "\nPick UCS Origin ")) ;; sets "pt1" to endpont you pick for origin 0'-0"
(command "ucs" pt1 "") ;; puts ucs on that point
(setq la (getvar "clayer")) ;; records your current layer and sets it equal to "la"
(setq lr1 (tblsearch "layer" "Dim")) ;; searches for the layer named "Dim" and sets it equal to "lr1"
(if (= lr1 nil) ;; if "lr1" not found (doesn't exist) it moves to the following function, if found, skips following function
(command "-layer" "make" "Dim" "color" "6" "" "")) ;;makes the layer "Dim" because it wasn't found
(command "-layer" "t" "Dim" "s" "Dim" "") ;; thaws and sets "Dim" layer current
(command "_qdim" lin "" "ordinate" pause "") ;; runs the quick-dim command, ordinate dimensions, on the lines and origin you selected, (you need to place the dims)
(command "ucs" "p") ;; sets the ucs back to "previous" location, could be WCS or other
(setvar "osmode" osm) ;; re-sets your recorded running osnaps
(setvar "clayer" la) ;; re-sets your recorded current layer
(princ)
) ;; end of routine
(princ)
Structo
2016-12-04, 05:26 AM
Thank you tedg friend. its working.
is this is possible for taking first line as "0" (with respect to least x or y coordinate) instead of selecting origin?
Thanks
Thank you tedg friend. its working.
is this is possible for taking first line as "0" (with respect to least x or y coordinate) instead of selecting origin?
Thanks
Good morning Structo,
I'm not sure I understand, you want the first line to be "0" without selecting origin?
Just so you know, "Ordinate" dimensions sees "0" at the origin of the current coordinate system being used.
So that is why I have the routine ask for "origin" (because it isn't at that point already).
If it were me, while doing your work, I would put the line you want at "0" at "0,0" while in the World Coordinate System, and then you wouldn't need to select the origin.
The lisp routine would need to get adjusted, see below, I removed the "place origin" part:
(defun c:foo2 (/ lin la lr1) ;; defines function "foo2" (command) you can change to whatever you'd like, and (/ list of local variables)
(setvar "ucsicon" 3) ;; sets your uscicon to on and at origin
(setq lin (ssget)) ;; sets "lin" equal to what you select (you select all the lines you want dimensioned)
(setq la (getvar "clayer")) ;; records your current layer and sets it equal to "la"
(setq lr1 (tblsearch "layer" "Dim")) ;; searches for the layer named "Dim" and sets it equal to "lr1"
(if (= lr1 nil) ;; if "lr1" not found (doesn't exist) it moves to the following function, if found, skips following function
(command "-layer" "make" "Dim" "color" "6" "" "")) ;;makes the layer "Dim" because it wasn't found
(command "-layer" "t" "Dim" "s" "Dim" "") ;; thaws and sets "Dim" layer current
(command "_qdim" lin "" "ordinate" pause "") ;; runs the quick-dim command, ordinate dimensions, on the lines and origin you selected, (you need to place the dims)
(setvar "clayer" la) ;; re-sets your recorded current layer
(princ)
) ;; end of routine
(princ)
Also attached a version of your "sample" drawing, you'll see the bottom of the first line is at "0,0" in the WCS, which is were it should be to do what you want to do.
Structo
2016-12-05, 04:03 PM
Hi tedg friend,
very good morning. yes exactly done as per my requirement. for vertical lines dimensioning is correct. but while applying for horizontal lines there is not developed from 0'-0". please have a look and kindly tweak.
Thank you.
Hi tedg friend,
very good morning. yes exactly done as per my requirement. for vertical lines dimensioning is correct. but while applying for horizontal lines there is not developed from 0'-0". please have a look and kindly tweak.
Thank you.
The same requirement applies, you need the end of the bottom line at coordinate 0,0 for this to work.
Structo
2016-12-06, 05:29 AM
thank you for assistance friend,
any possibility for taking least coordinate line value as 0'-0" from selection list?
Thanks.
thank you for assistance friend,
any possibility for taking least coordinate line value as 0'-0" from selection list?
Thanks.
Sorry man, this is all I have.
I have explained what you should do in regard to placing your geometry at WCS: 0,0 and ordinate dimensions, I don't know of a better way to do what you want.
Maybe others will provide some input to help you further along.
Just so you know..
AUGI is meant to get and give help when members can, we all have jobs too.
It's not a free programming service (I'm not trying to be rude, sorry if it sounds that way).
It's ok to ask for help here, but, it's usually best if you give it a try first an post what you have, instead of asking for people to provide a routine.
Good luck Stucto,
[cheers]
Abusaru
2019-10-10, 08:49 AM
Good morning Structo,
I'm not sure I understand, you want the first line to be "0" without selecting origin?
Just so you know, "Ordinate" dimensions sees "0" at the origin of the current coordinate system being used.
So that is why I have the routine ask for "origin" (because it isn't at that point already).
If it were me, while doing your work, I would put the line you want at "0" at "0,0" while in the World Coordinate System, and then you wouldn't need to select the origin.
The lisp routine would need to get adjusted, see below, I removed the "place origin" part:
(defun c:foo2 (/ lin la lr1) ;; defines function "foo2" (command) you can change to whatever you'd like, and (/ list of local variables)
(setvar "ucsicon" 3) ;; sets your uscicon to on and at origin
(setq lin (ssget)) ;; sets "lin" equal to what you select (you select all the lines you want dimensioned)
(setq la (getvar "clayer")) ;; records your current layer and sets it equal to "la"
(setq lr1 (tblsearch "layer" "Dim")) ;; searches for the layer named "Dim" and sets it equal to "lr1"
(if (= lr1 nil) ;; if "lr1" not found (doesn't exist) it moves to the following function, if found, skips following function
(command "-layer" "make" "Dim" "color" "6" "" "")) ;;makes the layer "Dim" because it wasn't found
(command "-layer" "t" "Dim" "s" "Dim" "") ;; thaws and sets "Dim" layer current
(command "_qdim" lin "" "ordinate" pause "") ;; runs the quick-dim command, ordinate dimensions, on the lines and origin you selected, (you need to place the dims)
(setvar "clayer" la) ;; re-sets your recorded current layer
(princ)
) ;; end of routine
(princ)
Also attached a version of your "sample" drawing, you'll see the bottom of the first line is at "0,0" in the WCS, which is were it should be to do what you want to do.
Hi Tedg
Thanks for this wonderful code;
I would like to know is there any way it can place the dimension on layers of the corresponding lines instead of dim layer.
Thanks in advance.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.