AutoCAD Civil 3D Customization

AutoCAD Civil 3D Customization

Reply
Employee
peterfunkautodesk
Posts: 720
Registered: ‎08-25-2009
Message 11 of 28 (836 Views)

Re: AEC Objects & LISP

04-27-2012 12:53 PM in reply to: coffeeTwitch

VB.NET or C# are the two languages that should be used to work with Civil 3D. While the COM model is still there, it is missing many of the new features that we have added to Civil 3D, is 5 to 10 times slower than the .NET API and may be dropped when the .NET API is competed.

 

Using LISP takes the slow COM model and attaches it to the impossible syntax of LISP (yes I know LISP and I've written more commerical LISP than most people around) giving you the worst of both worlds.

 

I strongly suggest stop all LISP development (that means you too Dave G) and move to .NET. The "Express Editions" from Microsoft are free and should provide all the tools that you need.

 

Peter Funk

Autodesk, Inc.



Peter Funk
Autodesk, Inc.

*Expert Elite*
Jeff_M
Posts: 4,472
Registered: ‎07-22-2003
Message 12 of 28 (832 Views)

Re: AEC Objects & LISP

04-27-2012 01:43 PM in reply to: peterfunkautodesk

peterfunkautodesk wrote:

... when the .NET API is completed.

 

Peter Funk

Autodesk, Inc.


still waiting...

Jeff_M, also a frequent Swamper
Member
Veliv
Posts: 4
Registered: ‎01-23-2008
Message 13 of 28 (812 Views)

Re: AEC Objects & LISP

05-07-2012 02:55 AM in reply to: peterfunkautodesk

Me too... I have waited that from Civil 3D 2008 version.. :manwink:

LISP is the best language for testing COM based features quickly upon multiple Civil 3D versions.

No need to add references to Visual Studio 20xx.

-VV

New Member
B.ll
Posts: 1
Registered: ‎06-13-2012
Message 14 of 28 (767 Views)

Re: AEC Objects & LISP

06-13-2012 05:07 PM in reply to: Veliv

try this:

<<<<<code<<<<<<

 

(defun c:getaec_example (/ acad_app aec_app aec_doc aec_pref temp_lu)
  (vl-load-com)
  (setq prod
  (vlax-product-key)
  )
  (setq prodStr (strcat
    "AecX.AecArchBaseApplication"
    (cond ((vl-string-search
      ">\\R17.0\\"
      prod
    )

    ".4.0"
   )
   ;;2007

   ((vl-string-search
      "\\R17.1\\"
      prod
    )

    ".5.0"
   )
   ;;2008

   ((vl-string-search
      "\\R17.2\\"
      prod
    )

    ".6.0"
   )
   ;;2009

   ((vl-string-search
      "\\R18.0\\"
      prod
    )

    ".7.0"
   )
   ;;2010
   ((vl-string-search
      "\\R18.2\\"
      prod
    )

    ".6.7"
   )
   ;;2012
   (t
    ""
   )
    )
  )
  )

  (if (and
 (setq *acad* (vlax-get-acad-object))
 (setq AEC
        (vla-getinterfaceobject *acad* prodStr)
 )
 (setq AECdoc
        (vla-get-activedocument AEC)
 )
      )

    (progn
      (setq AECpref (vlax-get-property
        AECdoc
        'Preferences
      )
      )
      (setq temp_lu
      (vlax-get-property AECpref 'LinearUnit)
      )

      (print temp_lu)
    )

  )
  (princ)
)

 

 

>>>>>>code>>>>>>

 

did not proof it for all versions.  just for 2012.

Employee
peterfunkautodesk
Posts: 720
Registered: ‎08-25-2009
Message 15 of 28 (759 Views)

Re: AEC Objects & LISP

06-13-2012 08:38 PM in reply to: peterfunkautodesk

Wonderful, but learn .NET for the future. LISP and COM is not the way to customize Civil 3D.

 

Peter Funk

Autodesk, Inc.



Peter Funk
Autodesk, Inc.

Active Contributor
lelandleahy4987
Posts: 44
Registered: ‎12-30-2008
Message 16 of 28 (753 Views)

Re: AEC Objects & LISP

06-14-2012 07:41 AM in reply to: peterfunkautodesk

I have started to learn .NET mainly to work with the rest of the world and outside of Autocad.

 

But it makes me wonder why Autodesk would add all the Visual Lisp functions to work with object models, then tell users not to use it. I personally am/was looking for ways that VLisp could read civil3d info from objects, like structures, not create them. Mainly to allow existing programs written in Lisp and working just fine be able to interact with the new objects. But by reading threads on here no matter what anyone asks or posts, Autodesk will continue to tell you to learn .NET. 

Leland
Civil3d 2012
Windows 7 64x (16 gigs ram)
Employee
peterfunkautodesk
Posts: 720
Registered: ‎08-25-2009
Message 17 of 28 (740 Views)

Re: AEC Objects & LISP

06-18-2012 06:41 AM in reply to: peterfunkautodesk

The interface that you are using in LISP is the COM API that was typically used with VBA. The COM API was designed to be easy to use compared to the C++ ObjectARX API. When it was developed it was known that by making it easy to use it gave up speed (in some cases it is 10 times slower than ObjectARX).

 

The direction of API has changed to .NET that is eaiser to use than ObjectARX but has almost the same speed (within 5%). With this change we have stopped all active development of the COM API and put all our effort behind the .NET API.

 

So I'm going to continue to say "don't use Visual LISP" for the following reasons:

1. It is slow

2. It is undocumented

3. It is untested

4. It is hard to use because ((it is LISP)(it uses a wrapper that allows LISP access to the VBA API))

5. It is missing all new object development (the new pressure pipes will not be exposed to COM)

6. It may go away in the future

7. It is very limited compared to .NET

 

Regards,

 

Peter Funk

Autodesk, Inc.



Peter Funk
Autodesk, Inc.

Member
Veliv
Posts: 4
Registered: ‎01-23-2008
Message 18 of 28 (731 Views)

Re: AEC Objects & LISP

06-19-2012 12:12 AM in reply to: peterfunkautodesk

Hi Peter,

I agree that we should use now and in the future .NET to develope Civil 3D applications.

I really have to give my opinion on those facts what you pointed out.

1. Lisp is slow -> thats OK

2. Lisp or ActiveX is not undocumented but there are not any lisp examples.

3. It´s as bullet proof as ActiveX can be.

4. Lisp code is hard to follow because of syntax. ActiveX interfaces are easy to use but hard to find the problem when it occurs.

5. Because Autodesk have desided to do so. It´s also easier to support one or two APIs only.

6. Or may be not. Of course in Civil 3D world Lisp is out of date.

7. All languages have their limitations even .NET but how to choose right tool to do the job. In small tasks Lisp is better because you don´t have to care about .NET references or servicepacks like .NET have to. In medium and larger Civil 3D projects it´s better to use .NET and ObjectARX languages together. There are now and in the future several ObjectARX functions which are not exposed to .NET. Example in Civil 3D Customdraw API is supported only with ObjectARX.

 

Cheers

Veli V.

Basepoint Oy

Employee
peterfunkautodesk
Posts: 720
Registered: ‎08-25-2009
Message 19 of 28 (725 Views)

Re: AEC Objects & LISP

06-19-2012 06:41 AM in reply to: Veliv

Unless I'm just making a macro function that runs a command, I don't use LISP. If I'm doing anything else, I use .NET.

 

While the .NET API isn't complete and there are still a few things that you can only do with COM you can add those into the .NET applications. On the flip side, there are features (superelevation) that you can only get in .NET that have no COM API. 

 

I wouldn't use the Custom Draw API, I would look at the Overrule API that is part of .NET because it is more powerful and can do more than just changing the graphics.

 

For #6, LISP was designed to work with DXF codes. That is where is was the most powerful. In an object world, it is the wrong tool.

 

Regards,

 

Peter Funk

Autodesk, Inc.



Peter Funk
Autodesk, Inc.

Member
Veliv
Posts: 4
Registered: ‎01-23-2008
Message 20 of 28 (717 Views)

Re: AEC Objects & LISP

06-19-2012 10:09 PM in reply to: peterfunkautodesk

Thank you Peter.

I think this is a good conversation to point out why we should move to .NET and ObjectARX.

-Veli V.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!