TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Peter2 on March 17, 2017, 08:05:27 AM

Title: How to start Lisp with Civil 3D-Props?
Post by: Peter2 on March 17, 2017, 08:05:27 AM
I would like to start with usage of Autolisp in Civil 3D (objects, props, ..)

Are there some references which describes the (different?) ways of communication between Lisp and Civil?

Have a fine weekend?
Title: Re: How to start Lisp with Civil 3D-Props?
Post by: Jeff_M on March 17, 2017, 09:35:23 AM
Peter, no, there are no references specifically for lisp with C3D. If you search the Autodesk C3D Customization forum you will find a number of posts steering you away from lisp lisp to the .NET API. You will also find quite a few small lisp commands that I, and others, have posted. The C3D COM API reference has not been updated since C3D 2012 (http://docs.autodesk.com/CIV3D/2012/ENU/API_Reference_Guide/com/civil_om.htm), and some of the links in that are broken so some creative editing of the url is needed at times.

There are quite a few of the COM objects that you cannot get/set properties for due to lisp not recognizing the type of variable it expects. However, there is still a lot you can do in lisp. Here is what I currently use (posted by another user on the C3D forum, I do not recall who that was though) to get the AeccLandApplication for any version of C3D (you will need this to get any C3D object without using a selection):
Code - Auto/Visual Lisp: [Select]
  1. (defun getaeccApp (/ *acad* C3D)
  2.            (setq C3D (strcat "HKEY_LOCAL_MACHINE\\"
  3.                              (if vlax-user-product-key
  4.                                (vlax-user-product-key)
  5.                                (vlax-product-key)
  6.                              )
  7.                      )
  8.                  C3D (vl-registry-read C3D "Release")
  9.                  C3D (substr
  10.                        C3D
  11.                        1
  12.                        (vl-string-search
  13.                          "."
  14.                          C3D
  15.                          (+ (vl-string-search "." C3D) 1)
  16.                        )
  17.                      )
  18.                  C3D (vla-getinterfaceobject
  19.                        (vlax-get-acad-object)
  20.                        (strcat "AeccXUiLand.AeccApplication." C3D)
  21.                      )
  22.            )
  23.       )
  24.     C3D
  25.   )
  26. )
  27.  
Title: Re: How to start Lisp with Civil 3D-Props?
Post by: Peter2 on March 20, 2017, 08:16:15 AM
Thanks Jeff, I will look at it.
Title: Re: How to start Lisp with Civil 3D-Props?
Post by: BIGAL on March 23, 2017, 09:49:50 PM
What are you trying to do ?

To give a couple of my examples.
Rotate multiple Aeccpoints
Contour style display via a toolbar rather than toolspace
Label styles via a toolbar
Title: Re: How to start Lisp with Civil 3D-Props?
Post by: Peter2 on March 24, 2017, 04:09:46 AM
Thanks.

In the meantime I found this document:
http://images.autodesk.com/adsk/files/AutoCAD_Civil_3D_API_Developer_s_Guide.pdf

I will start to work with it to understand the basic and the "data-system". For further questions I will come back to the forum.

EDIT: More links
Snoop Civil 3D 2015 Database (.bundle format)
http://adndevblog.typepad.com/infrastructure/2014/04/snoop-civil-3d-2015-database-bundle-format-1.html

Version 2017:
https://github.com/ADN-DevTech/Civil3DSnoop/tree/2017




Civil 3D 2017 - API Developer's Guide:
http://help.autodesk.com/view/CIV3D/2017/ENU/?guid=GUID-DA303320-B66D-4F4F-A4F4-9FBBEC0754E0

xx