style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
"CoffeeTwitch" wrote in messageI'm
href="news:6176127@discussion.autodesk.com">news:6176127@discussion.autodesk.com...
integrating it with some previously developed LISP code that will run in Civil
3D and Architecture (trying to automate our dimstyle creation). VBA is getting
left behind and I haven't taken the time to learn .net (just diving into C#).
Also, I'm a little obstinate and wanted to figure out how to do this in LISP
if you can.....
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
dir=ltr>
"Jeff Mishler" <miffATsonicDOTnet> wrote in message
href="news:6176290@discussion.autodesk.com">news:6176290@discussion.autodesk.com...
I can do this in C3D, but have no idea how to do so in ACA.
I'm sure it's similiar, but......
[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
"AeccXUiLand.AeccApplication"
(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
(t
""))))
(if (and
(setq *acad* (vlax-get-acad-object))
(setq C3D
(vla-getinterfaceobject *acad* prodStr))
(setq C3Ddoc
(vla-get-activedocument C3D))
)
(progn
(setq C3Dpref (vlax-get-property
C3Ddoc 'Preferences))
(setq temp_lu
(vlax-get-property C3Dpref 'LinearUnit))
(print temp_lu)
)
)
(princ)
)
[/code]
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
"CoffeeTwitch" wrote in messageI'm
href="news:6176127@discussion.autodesk.com">news:6176127@discussion.autodesk.com...
integrating it with some previously developed LISP code that will run in
Civil 3D and Architecture (trying to automate our dimstyle creation). VBA is
getting left behind and I haven't taken the time to learn .net (just diving
into C#). Also, I'm a little obstinate and wanted to figure out how to do
this in LISP if you can.....
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
"CoffeeTwitch" wrote in messageCool
href="news:6176320@discussion.autodesk.com">news:6176320@discussion.autodesk.com...
- that code runs fine for my Civil 3D - thanks. I think I can do the same with
ACA using a different arx (just not the AecBase). It's funny though: ACA
documents the AEC Base object model, but it seems like it's left out of Civil
3D docs. The arx is there in both programs though. It's my understanding that
you are supposed to be able to get into the AecBase for general info (like the
linear units settings). Have I misinterpreted this? It feels like there is
some fundamental thing I've got wrong after doing a lot of trial and all error
using the get interface object command (tried a lot of version numbers for
AecBase.Application.x.x). Maybe my reference string is wrong:
"AecBase.Application.x.x" ?
Peter,
I agree LISP is old, but there are still many users that are more comfortable with it. I have plenty of existing LISP routines that i would like to be able to access Civil3d objects, but dont want to learn a complete new language to do it. So being able to use visual lisp's object functions to access 3cd objects is very handy.
It is funny that I was told years ago that LISP was going away and VBA is the way to go, but LISP is still avaliable with the standard deployment but you have to download and install extra stuff to get VBA working in 2012.
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.
@peterfunkautodesk wrote:
... when the .NET API is completed.
Peter Funk
Autodesk, Inc.
still waiting...
Me too... I have waited that from Civil 3D 2008 version..
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
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.
Wonderful, but learn .NET for the future. LISP and COM is not the way to customize Civil 3D.
Peter Funk
Autodesk, Inc.
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.
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.
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
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.
Thank you Peter.
I think this is a good conversation to point out why we should move to .NET and ObjectARX.
-Veli V.
Can't find what you're looking for? Ask the community or share your knowledge.