Jump to content

Recommended Posts

Posted

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

attachment.php?attachmentid=57462&cid=1&stc=1

 

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.

what the lisp does.jpg

  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • Matt_D

    12

  • BIGAL

    6

  • BKT

    5

  • Cad64

    1

Top Posters In This Topic

Posted Images

Posted

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?

Posted

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.

Posted

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

Posted

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.

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