titoprax Posted October 6, 2017 Posted October 6, 2017 Hello everyone, I use Qdim for dimensions but I need the totaldim. Is it possible to create a lisp? with quick dimension. tipical lisp Add new lisp Thank you Quote
titoprax Posted October 6, 2017 Author Posted October 6, 2017 I think it would be very useful to work with this new lisp We would have dimension + total dimension. Quote
BIGAL Posted October 7, 2017 Posted October 7, 2017 titoprax yes its possible just have to do it via a lisp recording pick points and run dim twice and 2*offset for dim total. dim pt1 pt2 pt3 pt4 etc dim pt1 ptlast Quote
BIGAL Posted October 8, 2017 Posted October 8, 2017 (edited) This is a start needs a vertical option to be added its just for testing needs some extra error checking etc. Maybe a distance offset for dims rather than pick a point. It needs to take into account the 4 sides and directions involved. Uisng a L R U D as 1st pass is one way around the problem. ; Autodim a number of points in the 4 ortho directions including a total dim. ; By Alan H Oct 2017 (defun c:adim ( / lst x y lst2 pt3 pt) (defun AH_units () (SETQ ANGBASEE (GETVAR "ANGBASE")) (SETQ ANGDIRR (GETVAR "ANGDIR")) (SETQ LUNITSS (GETVAR "LUNITS")) (SETQ LUPRECC (GETVAR "LUPREC")) (SETQ AUNITSS (GETVAR "AUNITS")) (SETQ AUPRECC (GETVAR "AUPREC")) (SETVAR "LUNITS" 2) (SETVAR "ANGBASE" 0.0) (SETVAR "ANGDIR" 1) (SETVAR "LUPREC" 0) (SETVAR "AUNITS" 0) (SETVAR "AUPREC" 0) ) (defun old_AH_units () (SETVAR "LUNITS" lunitss) (SETVAR "ANGBASE" angbasee) (SETVAR "ANGDIR" angdirr) (SETVAR "LUPREC" luprecc) (SETVAR "AUNITS" aunitss) (SETVAR "AUPREC" auprecc) ) (ah_units) (setq lst '()) (while (setq pt (getpoint "Pick dim points in sequence <Cr> to stop")) (setq lst (cons pt lst)) ) (setq lenlst (length lst)) (setq pt3 (getpoint (nth 0 lst) "Pick offset pt")) (setq ang (angle (nth 0 lst) pt3)) (cond ((= 0.0 ang)(setq dirrvh "VER" direc "R")) ((= (/ pi 2) ang)(setq dirrvh "HOR" direc "U")) ((= pi ang)(setq dirrvh "VER" direc "L")) ((= (* pi 1.5) ang)(setq dirrvh "HOR" direc "D")) ) (if (= dirrvh "HOR") (progn (setq lst2 (vl-sort lst (function (lambda (e1 e2) (< (cadr e1) (cadr e2)) )))) (setq pmax (cadr (nth (- lenlst 1) lst2))) (setq pmin (cadr (nth 0 lst2))) (if (= direc "U") (setq off (- (cadr pt3) pmax)) (setq off (- (cadr pt3) pmin)) ) (setq pt4 (list (cadr pt3)(+ off (cadr pt3)))) ) ) (if (= dirrvh "VER") (progn (setq lst2 (vl-sort lst (function (lambda (e1 e2) (< (car e1) (car e2)) )))) (setq pmax (car (nth (- lenlst 1) lst2))) (setq pmin (car (nth 0 lst2))) (if (= direc "R") (setq off (- (car pt3) pmax)) (setq off (- (car pt3) pmin)) ) (setq pt4 (list (+ off (car pt3))(cadr pt3))) ) ) (old_AH_units) (setq x 0) (repeat (- (length lst) 1) (command "Dim" dirrvh (nth x lst) (nth (+ x 1) lst) pt3 "" "exit" ) (setq x (+ x 1)) ) (command "Dim" dirrvh (nth 0 lst) (nth (- (length lst) 1) lst) pt4 "" "exit" ) (princ) ) Edited October 14, 2017 by BIGAL Quote
BIGAL Posted October 8, 2017 Posted October 8, 2017 (edited) Have a few ideas for the 4 directions to pick automatically. Worked out how do that so it knows left up etc just debugging code code now. Edited October 9, 2017 by BIGAL Quote
BIGAL Posted October 14, 2017 Posted October 14, 2017 The code above has been updated and will work for 4 directions. Quote
aschiffer Posted December 15, 2017 Posted December 15, 2017 My apologies for bumping an older thread, but I didn't see a private message feature. I'm trying to use the program you wrote but don't understand the ending condition, " to stop." Is this a keystroke or a text input? Quote
BIGAL Posted December 16, 2017 Posted December 16, 2017 To quote Homer Simpson "where is the any key". For us a bit older means press Carriage return which on keyboards now is the Enter key. I use this method with pick objects also pick nothing should exit ie a blank spot on your dwg as the getpoint returns a Nil. Pressing Esc will exit but you get an error message. Quote
stlo Posted September 2, 2022 Posted September 2, 2022 Hi Bigal! This is another useful lisp from you!! Is there an easy way to modify your code to set a predefine offset distance when you click for the dimensions to appear? Like the first one could be 6.0 from the last pick point and the second one 12.0 from that same point? Where would I enter those informations in you code! It's probably a setq off 6.0 pi2 and setq off 12.0 pi2 but I'm not sure where to add this? Thanks! Quote
BIGAL Posted September 3, 2022 Posted September 3, 2022 (edited) Its old code now but can see that pt3 & pt4 are used for dim offset pt. I will have to have a think about how I did it and change to fixed offset. Something to do with initial pick of pt3. Edited September 3, 2022 by BIGAL Quote
BIGAL Posted September 3, 2022 Posted September 3, 2022 Tried on a more random shape so it needs a bit more than just 6 & 12 need to find outermost point then add the 6 & 12, also found a bug needs ortho on. Will have a play. Quote
stlo Posted September 6, 2022 Posted September 6, 2022 I've tried to add this (at both places on your code) and it worked from the first 2 dimensions compared to the overall one! After trying, 8 is better than 6 for me because the dimensions are not overlapping each other! It creates a space of 8 units in between. I also add a "minus" before the 8.0 on the "pmin" line so when I select to offset "down" or "left" the overall dimension appears far down and far left! The first click for the dimensions to appear is still manual but it doesn't really matter, it was more for the overall dimension to have enough space to not overlap the first ones! Let me know if it makes sense! Thanks again! (setq off 8.0 pi2 (- (car pt3) pmax)) (setq off - 8.0 pi2 (- (car pt3) pmin)) Quote
BIGAL Posted September 7, 2022 Posted September 7, 2022 Glad you got it to work must have dropped from my to do list. Quote
Recommended Posts
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.