Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

accessing c3d info thru lisp

2 REPLIES 2
Reply
Message 1 of 3
lelandleahy4987
486 Views, 2 Replies

accessing c3d info thru lisp

is there a way to see the object model of a c3d drawing? I am looking for access pipe and structure information thru LISP is possible. I dont want to change the data just extract it for use in other LISP routines.

 

thanks!

Leland
Civil3d 2020
Windows 10 64x (32 gigs ram)
2 REPLIES 2
Message 2 of 3
Jeff_M
in reply to: lelandleahy4987

Here is some code I put together while researching what could be accessed via lisp. It is by no means complete, but should get you started if you know much about lisp. If you get stuck, ask...oh, I believe another user, Dave Couch, was also pursuing this a while back. Perhaps he can chime in if got any further than this.

 

;;select a structure
(setq ss (ssget ":S" '((0 . "AECC_STRUCTURE"))))
(setq struct_Obj (vlax-ename->vla-object (ssname ss 0)))
(setq connPipeNames (vlax-get struct_Obj 'connectedpipenames)
      rim (vlax-get struct_Obj 'rimelevation)
      hgt (vlax-get struct_Obj 'structureheight)
      sump (vlax-get struct_Obj 'sumpelevation)
      connPipes (vlax-get struct_Obj 'connectors)
      location (vlax-get struct_Obj 'position)
      )
(setq xyz_location (list (vlax-get location 'x)
			 (vlax-get location 'y)
			 (vlax-get location 'z)
			 )
      )

;;; get the pipe data for the first connected pipe
(setq part (vlax-invoke-method connPipes 'item 0))
(setq pipe (vlax-get-property part 'networkpart))
;;this next line fails, as does any other attempt to acess pipe properties
(setq pipename (vlax-get-property pipe 'name))

;;however, since the Pipe object inherits from a Curve Object, we can get the end points using the start/end params
(defun getparam (pipe param)
  (vlax-safearray->list
    (vlax-variant-value
      (vlax-get-property pipe 'pointatparam param)
      )
    )
  )
 
(setq end0 (getparam pipe 0.0)
          end1 (getparam pipe 1.0)
)

 

Gotta love this forum software. That smiley face in the code is a : followed by an S

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 3
lelandleahy4987
in reply to: Jeff_M

I will give this a try and yeah it is  a wonderful start! any other suggestions are always helpful.

Leland
Civil3d 2020
Windows 10 64x (32 gigs ram)

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report