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

Give Points Perpendicular to Face Normals

3 REPLIES 3
Reply
Message 1 of 4
ArchD
549 Views, 3 Replies

Give Points Perpendicular to Face Normals

I have this lisp that AllenJessup gave to me and it's about 15 years old. The purpose of it, is to create points at a specified offset from a faces normals along it's vertices. 

 

Basically, what is going on is that I have 3D faces extracted from a Civil 3D surface. I tried to created a surface from these 3D faces and use SURFOFFSET, but it will not work for me.

 

So, after a discussion in another thread, if this lisp could be updated and perfected, this would help out huge with a feature that is left out of Civil 3D. Nothing in this lisp should require Civil 3D however.

 

Is it possible to have this lisp run and ask you to select 3D faces, then after selection, ask for the offset value you would like the points to be from the normals of the face at each vertices, then produce the points?

 

Any help would be appreciated. I wish I had a knack for lisp, but I'm more of a visual person, coding hurts my brain. 😉

Archie Dodge
Applications Expert - Infrastructure Solutions Division
IMAGINiT Technologies
3 REPLIES 3
Message 2 of 4
stevor
in reply to: ArchD

Yours should, a tried and true method. With UCS and capture of the newpoint coords;

 

And luck in posting the text of the code.

 

; return Ucs coords, AusCadd.com
 (DeFun dxf_EU (gn edL / vv )
  (if (and (setq vv (cdr (assoc gn edL)))
           (member gn (list 10 11  210 ))) ; others may exist!!!
    (trans vv (cdr (assoc -1 edl)) 1)  vv  )  )
 
   
(princ" MassPnts ")
 ; MassPnts Original Author - AllenJessup
 (Defun c:mpp ()  (arxload "geomcal")
  (princ"\n Sel 3DFaces for 10du offset points, no direction control: ")
  (if (setq ssi 0  fqi 0   ss1 ( ssget  ) ) ; Select
   (progn
    (setq ssq (sslength ss1)   )
    (while (< ssi ssq)
     (setq en (ssname ss1  ssi)  dL (entget en)) ;
     (if (= "3DFACE" (Dxf_eu 0 dL))
      (progn
       (setq P1 (dxf_eu 10 dL)  P2 (dxf_eu 11 dL)  fqi (1+ fqi) ;
             P3 (dxf_eu 12 dL)  P4 (dxf_eu 13 dL)) ; iff 4th          ;
       ;
       (command "point" (c:cal "P1 + 10*nor(P1,P2,P3)")) ; set First Point
       (setq npe1 (entlast)  np1 (getvar "lastpoint" ) )
       (command "point" (c:cal "P2 + 10*nor(P2,P3,P1)")) ; set Second Point
       (setq npe2 (entlast)  np2 (getvar "lastpoint" ) )
       (command "point" (c:cal "P3 + 10*nor(P3,P1,P2)")) ; set Third Point
       (setq npe3 (entlast)  np3 (getvar "lastpoint" ) )
       (if P4 (command "point" (c:cal "P4 + 10*nor(P3,P1,P2)")))
       (if P4 (setq npe4 (entlast)  np4 (getvar "lastpoint" ) ))
       ;
       (grdraw p1 np1  1)  (grdraw p2 np2  1)  (grdraw p3 np3  1)
       (if P4  (grdraw p4 np4  1) )
      )
     )
     (setq ssi (+ ssi 1))
    )
   )  
  ) ; Close while
  (princ (strcat "\n  : " (itoa ssi) ", Faces: " (itoa fqi )))
 (princ" done ") (princ) ) ; def

S
Message 3 of 4
ArchD
in reply to: stevor

I tried this out and the result didn't really change much from the original. Maybe I misunderstood your post. I attached my result. Some points don't offset at all, while others move along the edge of the face, and others offset perpendicular from the face.

 

I'm sorry if I'm misunderstanding your post. I'm not good at figuring out how the code is supposed to go. 😞

Archie Dodge
Applications Expert - Infrastructure Solutions Division
IMAGINiT Technologies
Message 4 of 4
stevor
in reply to: ArchD

Me either, of understanding most posts.

 

My version, when loaded, created POINTs as per the original lsp that you posted, with some other features that we used.

 

Attached should be about the same thing.

Look up loading a lsp file, if that is a problem.

S

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

Post to forums  

Autodesk Design & Make Report

”Boost