Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create and Configure Custom Objects using LISP

13 REPLIES 13
Reply
Message 1 of 14
Kyudos
1594 Views, 13 Replies

Create and Configure Custom Objects using LISP

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?

13 REPLIES 13
Message 2 of 14
Ranjit_Singh2
in reply to: Kyudos

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.

Message 3 of 14
Kyudos
in reply to: Ranjit_Singh2

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.

Message 4 of 14
Ranjit_Singh2
in reply to: Kyudos


@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.

Message 5 of 14
Kyudos
in reply to: Ranjit_Singh2

They have actual (COM) properties though - can I set those?

Message 6 of 14
Ranjit_Singh2
in reply to: Kyudos

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.

Message 7 of 14
john.uhden
in reply to: Ranjit_Singh2

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

Message 8 of 14
Ranjit_Singh2
in reply to: john.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.

Message 9 of 14
Kyudos
in reply to: Ranjit_Singh2

Yes it was more like trying (in LISP):

  • Call my object creation command passing a point to put it in the right spot
  • Get hold of just created object
  • Set the value of a property I have exposed through COM (i.e. visible in the Property window) (e.g. MYOBJ.Flow or similar)
Message 10 of 14
john.uhden
in reply to: Ranjit_Singh2

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

Message 11 of 14
Kyudos
in reply to: john.uhden

Yeah - I know nothing about LISP and less than that about Visual LISP 😉

Message 12 of 14
Ranjit_Singh2
in reply to: john.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.

Message 13 of 14
hgasty1001
in reply to: Kyudos

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

 

 

Message 14 of 14
artc2
in reply to: Kyudos

If you've properly implemented dxfInFields() in your custom entity classes, then you should be able to use (entmake) to create instances of your custom entities and (entmod) to modify them.

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report