Is it possible to create and configure my custom objects from LISP? Say I have a need to create hundreds of things at given coords and don't want to do it all by hand?
I've sort of managed the placing by running my 'create' command and passing points from LISP, but what if I want to place my object somewhere and then set some of its properties? Can that be done?
What kind of custom objects? As long as they are still composed of native AutoCAD entities and you have some logic for their placement, I believe it can be done. ActiveX exposes quite a few methods and properties for most AutoCAD objects.
My custom objects are all derived from AcDBPolyline or AcDbBlockReference, but it is my properties I want to set, not the properties of the underlying ACAD object.
@Kyudos wrote:
My custom objects are all derived from AcDBPolyline or AcDbBlockReference, but it is my properties I want to set, not the properties of the underlying ACAD object.
By the above, I assume you are talking about some non-graphical data, such as product code, name etc? You can do that with extended data or Xrecords.
When you attach something as xrecord, that's all it is. You may need to read and evaluate it every time you need to do something. If you attach it as an extended data then you use DXF codes and the attach data has to follow certain rules (data types for instance). Given those limitations I don't think you can attach a COM property to an object and manipulate it using LISP or Visual LISP. However, you can expose the Type library to your routine and have some functionality attached to your object that makes use of the specific library's COM properties.
I thought that you could create custom objects only via ARX. Is that no longer true?
It would be such fun to create custom objects via Lisp.
John F. Uhden
Yes. I don't think we are talking about creating objects though. Unless I am completely misunderstanding, OP says he already has COM object properties that I am assuming he compiled using .NET Depending on what functionality was added the properties could be accessed via ARX / LISP and/ or AutoCAD commands. Just like you can import other COM libraries, I would imagine if a new library was created it could be accessed via LISP after importing the type library.
OP would know exactly what functionality has been built in his application that exposes all the custom properties.
Yes it was more like trying (in LISP):
Might you mean OP "should" know...?
If he doesn't, wouldn't (vlax-dump-object object 1) reveal the properties and methods? That is mostly how I learned to deal with Land Desktop objects.
John F. Uhden
Two different things again. You can use vlax-dump-object on an instance of the object. On importing type library all methods and properties are loaded on top of AutoCAD. One would then be able to call the specific needed function but still not be able to use vlax-dump-object unless the object is instantiated.
Now, assuming OP generated a type to expose the methods /properties consistent with vlax-dump-object function, he will see it. But OP posting a question in the first place is a very good sign that these methods will not be exposed via vlax-dump-object. However, he could import his type library and see if the methods and properties get loaded.
Hi,
Custom objects can not be created by Autolisp, COM (VBA) nor .NET. API, Only ARX C++ can do it. And it's not an easy task to create a non trivial custom object in C++. if you are in the need to create one, you can start here: Basic Custom Object
Gaston Nunez
Can't find what you're looking for? Ask the community or share your knowledge.