Jump to content

the challenge lisp


motee-z

Recommended Posts

hi friends i have a program ezysurf this program can draw a cross section or profile by drawing a line on a surface this surface consist of a 3d face for every three points and the 3d face lied on a specific layer the question is can any body help how we can get the list(x y z) of intersection points between this line and the edge of every 3d face in addition to start and end point of this line

thanks

Link to comment
Share on other sites

Can be done you need to create new lines representing the faces say on another layer then you draw your line and do a "intersect" for every line it crosses giving the point required.

 

this is just a start but is in right direction need a 3dface to lines to test explode all 3dfaces.

 

relevant bits cut out of Auto dimensioning routine
(setq ss (ssget "F" (list pt1 pt2))) ;your line
(while (setq en (ssname ss 0)) ;loop trhough 3dface lines
    
    (setq dimpt1 (cdr (assoc 10 (entget en))))      
    (setq dimpt2 (cdr (assoc 11 (entget en))))      
    (setq newpt2 (inters pt1 pt2 dimpt1 dimpt2 nil))      

Link to comment
Share on other sites

thanks BIGAL to reply but i think it is difficult to explode 3d faces to lines i know the lisp is very complicated but someone expert can do it

Link to comment
Share on other sites

Hi motee-z

You don't need a lisp for this job. Section command works well on surfaces to. In order to do that, you have to transform your 3dFaces to Surface. I don't use ribbon, but in classic Acad you can do that via Modify->Mesh Editing->Convert to Faceted Surface (or Convert to Smooth Surface, same result for 3DFace); then Union (like for solids) and finally Section... just like for regular Solids.

Link to comment
Share on other sites

Thanks Stefan for the answer for something else I was trying to do, re the post the section whilst it slices will not return the x.y.z values where they slice the surface which was the original request.

 

heres the code for pulling the xyz of 3dfaces out use pt1 pt2 pt3 as the 3 sides of a triangle

 

(setq ss (ssget "X" '((0 . "3DFACE"))))
(setq y  (sslength ss))  
       
(If   (=  ss nil)
(progn 
 (Getstring  "\nNo 3d faces . Press any key when ready ")
 (exit)
)
)
(setq y  (sslength ss))  
(repeat y
       (setq en (ssname ss x)
             ed (entget en)
             p1 (cdr (assoc 10 ed))
             p2 (cdr (assoc 11 ed))
             p3 (cdr (assoc 12 ed))
             p4 (cdr (assoc 13 ed))  ; p4 not required
             )
)

Link to comment
Share on other sites

thanks BIGAL what is the aim of getting the list of 3d face head you think can be connected with lines

on other hand the variable ed gives nill

Link to comment
Share on other sites

Didn't test code just cut and pasted from elsewhere needs a X value or use Foreach not tested but should work

 

(setq x 0)
(setq x (+ x 1)) 
(setq ss (ssget "X" '((0 . "3DFACE"))))
(setq y  (sslength ss))  
       
(If   (=  ss nil)
(progn 
 (Getstring  "\nNo 3d faces . Press any key when ready ")
 (exit)
)
)
(setq y  (sslength ss))  
(repeat y
       (setq en (ssname ss x)
             ed (entget en)
             p1 (cdr (assoc 10 ed))
             p2 (cdr (assoc 11 ed))
             p3 (cdr (assoc 12 ed))
             p4 (cdr (assoc 13 ed))  ; p4 not required

             )
(princ p1) ; for testing
(setq x (+ x 1))
)

Link to comment
Share on other sites

what is the command that can get the apparent intersection between 2 line one of them is has different z

we know if the 2 line are 2d the code is

(inters p1 p2 p3 p4)

thanks

Link to comment
Share on other sites

@motee-z

 

See if you take a cue from this (bad) English version of my lisp.

 

Description: selecting a line/polyline2D/polyline3D that intersects a surface consisting of triangular 3DFACE, generates a polyline3D (profile) on the model.

 

:)

PROF_3DF_EN.LSP

Link to comment
Share on other sites

  • 2 weeks later...

I respond publicly to a request for explanation on Lisp received at the private message as it may interest to other users.

 

_______________________________________________________

Intersection section line/3DFACE

Repeat for the three sides of the triangle (3DFACE)

  • pA pB -> points of the section line
  • p1 p2 -> vertices side of the triangle
  • p1a p2a -> vertices p1 and p2 to altitude 0,00
  • p3 -> intersection of pA,pB/p1a,p2a
  • if p3 ->
    • p4 p5 -> points on the vertical p3
    • p6a -> intersection point (in top view) section line/3DFACE

339.jpg

 

 

 

________________________________________________

Point in the plane of 3DFACE

 

Use: Help AutoCAD

 

This is the use in lisp posted:

(cal "pINT_z=ilp(p_INT_inf,p_INT_sup,p1,p2,p3)")

 

Note: remember to load the geometry calculator:

(if (not (member "geomcal.arx" (arx))) (arxload "geomcal"))

 

340.jpg

 

 

:):)

Link to comment
Share on other sites

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