Matt_D Posted March 24, 2016 Author Posted March 24, 2016 Sorry BKT, I completely missed that. yes, the code drew lines appropriately and then some. I took out the alert and did something else which stopped the 'then some' lines from being drawn. However, I'm getting a foreach syntax error without the ; ====== As of right now, this is the current code and this screen shot is from a freshly opened drawing as 'ready only' with a single ordinate dimension moved away from the datum used for the others. (defun c:ordinatecheck (/ origin ss obj StPt EdPt x) (setq origin (getpoint "Pick a point or type coordinate: ")) (command "-layer" "m" "DIM_WRONG" "c" "RED" "DIM_WRONG" "p" "n" "DIM_WRONG" "s" "DIM_WRONG" "") (if (setq ss (ssget "X" (list (cons 0 "DIMENSION")(cons 100 "AcDbOrdinateDimension")))) (repeat (setq x (sslength ss)) (setq obj (entget (ssname ss (setq x (- x 1))))) (setq StPt (cdr (assoc 10 obj))) (setq EdPt (cdr (assoc 11 obj))) ; (alert (strcat "x="(rtos (car StPt) 2 2) " y="(rtos (cadr StPt) 2 2))) ;; Changed to StPt? (if (not (equal origin StPt)) ;; Changed "=" to "equal" (entmake (list '(0 . "LINE") '(100 . "AcDbLine") (cons 10 StPt) ;; Changed to StPt (cons 11 EdPt) ;; Changed to EdPt ; (foreach) ) ) ) ) ) (princ) ) The Green Circle indicates ordinate dimensions that have the correct datum, as this was the User Origin from the input. This was the comparison point. The Red Circle indicates the ordinate dimension that I moved to show an incorrect datum. The lisp should be drawing only to this incorrect ordinate dimension with a single red line. If the image comes out clear enough, you can see multiple extra lines throughout the drawing- I don't want them in there. Its definitely progress. Quote
BKT Posted March 24, 2016 Posted March 24, 2016 It looks like this image is from paper space - is that right? I haven't tested for the ordinate datum being outside the viewport. Don't suppose you can strip the border and post the drawing? Quote
Matt_D Posted March 24, 2016 Author Posted March 24, 2016 Yes, it's from paperspace. I have my autocad setup that way so I can see all but the darkest of colors. I tested the lisp outside the viewport and it works fine, that's what the result is. It translates well enough. And I can't exactly strip the drawing for a few reasons. The pieces are referenced and are big. two, I don't know how comfortable the company would be with me adding in the objects. The most I think I could provide would be unintelligent, general objects and even that I'd like to get permission for. However, I won't be able to ask for that until monday...the powers that be aren't going to be in tomorrow (good friday). I got the lisp to work once or twice. I think if I analyze the code and work it a little bit I can get it to work properly. I think I can get it to the point of marking write and wrong. I just have to tinker with it. Quote
BKT Posted March 25, 2016 Posted March 25, 2016 I understand about the drawing. If you want to try this, I've changed the code a little to try to put an ellipse around the dimensions instead of drawing a line to it. Just a thought... Let us know how your tinkering turns out! (defun c:ordinatecheck (/ origin ss obj StPt EdPt Ornt x) (setq origin (getpoint "Pick a point or type coordinate: ")) (command "-layer" "m" "DIM_WRONG" "c" "red" "DIM_WRONG" "p" "n" "DIM_WRONG" "s" "DIM_WRONG" "") (if (setq ss (ssget "X" (list (cons 0 "DIMENSION")(cons 100 "AcDbOrdinateDimension")))) (repeat (setq x (sslength ss)) (setq obj (entget (ssname ss (setq x (- x 1))))) (setq StPt (cdr (assoc 10 obj))) (setq EdPt (cdr (assoc 11 obj))) (setq Ornt (cdr (assoc 70 obj))) (if (= (cdr (assoc 70 obj)) 38)(setq maj (list (* (getvar "DIMTXT") 2.5) 0.0 0.0))) (if (= (cdr (assoc 70 obj)) 102)(setq maj (list 0.0 (* (getvar "DIMTXT") 2.5) 0.0))) (if (equal origin StPt)[color=red]<---;; Might have to make this (if (not (equal origin StPt))[/color] (entmake (list (cons 0 "ELLIPSE") (cons 100 "AcDbEntity") (cons 100 "AcDbEllipse") (cons 10 EdPt) (cons 11 maj) (cons 40 0.5) (cons 41 0) (cons 42 (* 2 pi)) ) ) ) ) ) (princ) ) Quote
Matt_D Posted March 25, 2016 Author Posted March 25, 2016 When I run your code with the ellipse, it comes out with a "error: bad dxf group: (11)" I'll post a fix if I find one. 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.