Jump to content

How to start a lisp like DInfo Belong to LEE?


Recommended Posts

Posted

A question from a begginer:

 

How to add a data to mouse pointer such as LEE lisp DInfo?

Posted

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.

Posted

Is there an simple example?

Because I tried to study DInfo lisp but lost.

Its higher technique more than my little knowledge.

Posted

Have you read the help file on grRead? I can provide an example, but it would serve no purpose if you didn't know how grread functioned.

Posted

In fact I did but didnt understand the help file.

Posted

Clunky example I did.

 

You have to understand, grread is neat and fun, but mostly it's useless and requires too much work/aggravation for the tiny payoff.

Posted

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

Posted

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.

Posted

Oh yeah, you might also be interested in grtext; it will display your message at the bottom left of the AutoCAD window.

Posted

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

  • 1 month later...
Posted

DInfo return error for entity "POLYLINE" into XREF and INSERT...

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