Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Mentor
ArchD
Posts: 319
Registered: ‎07-30-2008
Message 1 of 4 (390 Views)

Give Points Perpendicular to Face Normals

390 Views, 3 Replies
06-19-2012 07:40 AM

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

Archie Dodge

Civil 3D 2013
Windows 7 64-bit
Xeon E5-1620 v2 @ 3.70 GHz
Nvidia Quadro K4000
32.0 GB RAM
Mentor
stevor
Posts: 854
Registered: ‎12-26-2005
Message 2 of 4 (373 Views)

Re: Give Points Perpendicular to Face Normals

06-19-2012 09:02 AM 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
Mentor
ArchD
Posts: 319
Registered: ‎07-30-2008
Message 3 of 4 (362 Views)

Re: Give Points Perpendicular to Face Normals

06-19-2012 10:36 AM 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. :smileysad:

Archie Dodge

Civil 3D 2013
Windows 7 64-bit
Xeon E5-1620 v2 @ 3.70 GHz
Nvidia Quadro K4000
32.0 GB RAM
Mentor
stevor
Posts: 854
Registered: ‎12-26-2005
Message 4 of 4 (354 Views)

Re: Give Points Perpendicular to Face Normals

06-19-2012 01:00 PM 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
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.