Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Check point distance to solid?

10 REPLIES 10
Reply
Message 1 of 11
hypersonic
666 Views, 10 Replies

Check point distance to solid?

Is there any way through autolisp to check the distance between a point and a solid?

 

Thanks!

10 REPLIES 10
Message 2 of 11
_Tharwat
in reply to: hypersonic

Try it this way ....

 

(setq ss (vlax-ename->vla-object (car (entsel "\n Select Object :"))))
(setq p (vlax-curve-getClosestpointto ss '(0. 0. 0.) T))

 

 Tharwat

Message 3 of 11
hypersonic
in reply to: hypersonic

I get: errorbad argument value: AcDbCurve 43 

When running and selecting a solid as the object......

Message 4 of 11
_Tharwat
in reply to: hypersonic

Add the following code to the first of the previous codes .

 

(vl-load-com)

Message 5 of 11
_Tharwat
in reply to: _Tharwat

What kind of Solid entity you are trying to get a close point to it ?

Message 6 of 11
hypersonic
in reply to: hypersonic

a "3DSOLID".....

 

 

Message 7 of 11
_Tharwat
in reply to: hypersonic

I am sorry , the codes that I provided is not working with 3dsolid .

 

Could you please bring a dwg to sheck it out if it is possible .

 

Regards.

Message 8 of 11
stevor
in reply to: hypersonic

A brief way of getting a distance, or a surface point, is to use the point value of the return of the entsel function.

S
Message 9 of 11
hypersonic
in reply to: _Tharwat

Here is a copy of the drawing. I tried the function on the solid, and the surfaces and it returns the same error.

It does work on the simple polyline shape however.

Message 10 of 11
_Tharwat
in reply to: hypersonic

Try the command : dist

Message 11 of 11
stevor
in reply to: hypersonic

Or, you try, on your dwg, which I do not want here,

 

  ; dist to 3Dsolid edges
  (defun c:pd (  / np p00 osm  )  (graphscr) (redraw)
   (setq osm (getvar "osmode")  p00 '(0 0 0)) ; or use your coords, or get a point
   (setvar "osmode" 545) ; end near int, or set yours, 1 end  32 int  512 nea
   (setq np (getpoint p00 "\n Pick Oject Edge or Corner" ))
   (if np 
    (progn 
     (setq nd (distance p00 np))  (grdraw p00 np 1) 
     (princ" Dist:  ")(prin1 nd ))) 
  (setvar "osmode" osm ) (princ) )
  
  (c:pd)

S

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost