Jump to content

How to start a lisp like DInfo Belong to LEE?


asos2000

Recommended Posts

You will need to master the grRead function to accomplish that - it tracks all user input from mouse & keyboard, hence in a loop one can continously monitor user input.

Link to comment
Share on other sites

Its a poor start

starting from a lisp from this thread

 

But have 2 errors

- when point to Vertical line

- when point to pline

 

(defun C:IntLine ()
 (prompt "\nMove Crosshairs To Inspect Objects.")
 (while (and
   (setq INPUT (grread T))
   (= (car INPUT) 5)
   )
   
     (setq INPUT_COORD (cadr INPUT))
     (setq ENTITY_FOUND (ssget INPUT_COORD))
     (if ENTITY_FOUND
(Progn
  (setq ENTITY_LIST (entget (ssname ENTITY_FOUND 0)))
         (setq p1 (cdr (assoc 10 ENTITY_LIST)))
         (setq p2 (cdr (assoc 11 ENTITY_LIST)))
  (setq tan2 (/ (- (cadr p2) (cadr p1)) (- (car p2) (car p1))))
  (prompt (strcat "\rObject: " (rtos (abs (* tan2 100))2 2) "%                     "))
  
  )
)
   )
 (princ)
 )

Link to comment
Share on other sites

LWPolylines don't have 11 codes. If you are just wanting start and end, I'd suggest the vlax-curve-getStartPoint, vlax-curve-getEndPoint (and no, you don't have to convert to vla-objects). However, for what you're doing, I'd also filter the polylines to only have one segment (dxf code 90, I think); you don't want to make your calculation based on a polyline with 75 bends, when you are wanting the angles between the start and end points.

Link to comment
Share on other sites

Quick example I suppose:

 

(defun TextDisplay ( text / e l gr vs )

 (if (setq e
       (entmakex
         (list
           (cons 0 "TEXT")
           (cons 10 (getvar 'VIEWCTR))
           (cons 40 (/ (getvar 'VIEWSIZE) 30.))
           (cons 1 text)
           (cons 62 3)
           (cons 72 0)
           (cons 73 3)
           (cons 11 (getvar 'VIEWCTR))
         )
       )
     )
   (progn (setq l (entget e))
     (while (= 5 (car (setq gr (grread 't 13 0)))) (setq vs (getvar 'VIEWSIZE))
       (entupd
         (cdr
           (assoc -1
             (entmod
               (subst (cons 11 (trans (polar (cadr gr) (/ pi -4.) (/ vs 20.))  1 0)) (assoc 11 l)
                 (subst (cons 40 (/ vs 30.)) (assoc 40 l) l)
               )
             )
           )
         )
       )
     )
     (entdel e)
   )
 )

 (princ)
)


(defun c:test nil (TextDisplay "Lee Mac") (princ))

Link to comment
Share on other sites

  • 1 month later...

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