Autolisp: Select imprinted point on a solid

Autolisp: Select imprinted point on a solid

Anonymous
Not applicable
1,090 Views
4 Replies
Message 1 of 5

Autolisp: Select imprinted point on a solid

Anonymous
Not applicable

Good morning,

 

is there a way in lisp to select an imprinted point just created by a line on a 3d solid?

I was thinking something with like ENTLAST but apparently i can't make it work.

 

thanks in advance for your suggestions!

0 Likes
Accepted solutions (1)
1,091 Views
4 Replies
Replies (4)
Message 2 of 5

DannyNL
Advisor
Advisor
Accepted solution

How do you create the imprint, with LISP or just with the IMPRINT command?

If you create it with LISP (selection by entsel?) than you would have a point where you clicked on the object and can use that as a argument for other functions. Or maybe the variable LASTPOINT can be used as well.

 

ENTLAST will not do the trick as it will only pass the last created objected and not the (imprint on the) 3D solid.

Message 3 of 5

Anonymous
Not applicable

Thanks Danny!

 

This is my code where i created the point in lisp with the imprint command. Now i have to measure the distance between a point (p) and the imprint. Currently i have the user select the imprinted point.

 

(defun C:DAVIDE(/ var val p solidSS ent linevar)

    (setq var '("Osmode" "Expert")
          val  (mapcar 'getvar var))
    (mapcar 'setvar var '(0 1))

; TURN OFF SOLID LAYER
    (command "_.-layer" "OFF" "IMAGINARY SURFACE" "" "")

; ENTER LAT, LON OF THE POINT OF INTEREST
    (command "geomarklatlong" PAUSE PAUSE " ")

; SELECT NODE JUST CREATED
    (setq p (cdr (assoc 10 (entget(ENTLAST)))))

; DRAW LINE 200 UNITS TALL ORTHO TO XY FROM NODE
    (command "_.line" p (list (car p) (cadr p) (+ (caddr p) 200)) "")
    (setq linevar (ssget "_L"))
    (mapcar 'setvar var val)

; TURN ON SOLID LAYER
    (command "_.-layer" "ON" "IMAGINARY SURFACE" "")

; IMPRINT LINE WITH SOLID
    (setq solidSS (ssget "X" (list '(0 . "3DSOLID")(cons 8 "IMAGINARY SURFACE")))) ; this will get you a selection set containing the solid
    (setq ent (ssname solidSS 0)) ; retrieve first entity in the list (there should be only 1)
    (command "_.imprint" ent linevar "_Y" "")

; SELECT IMPRINTED POINT
;   (setq q (cdr (assoc 10 (entget(ENTLAST)))))

; CALCULATE DISTANCE FROM ORIGINAL POINT TO THE IMPRINTED POINT
    (command "dist" p PAUSE) ; HERE IS WHERE I WOULD LIKE TO REPLACE THE PAUSE WITH THE POINT JUST IMPRINTED

0 Likes
Message 4 of 5

Anonymous
Not applicable

LASTPOINT worked.

 

Thanks!

0 Likes
Message 5 of 5

DannyNL
Advisor
Advisor

Ok, great it works with the LASTPOINT variable.

Glad I could advice Smiley Happy

0 Likes