Author Topic: Alternative to (command "-PropertyDataEdit"....)  (Read 2932 times)

0 Members and 1 Guest are viewing this topic.

mr_nick

  • Guest
Alternative to (command "-PropertyDataEdit"....)
« on: April 08, 2013, 07:05:21 AM »
Firstly I should advise that I'm working with AutoCAD Architecture 2012 here so those people using vanilla AutoCAD will not have access to the feature I am discussing i.e. Property Set Definitions.

I'm currently trying to devise a bit a code to manipulate Property Set data but have hit a bit of a wall. I can attach a property set and read it but I'm having trouble editing it via lisp and more specifically from within a reactor. The only method I have found for editing the property set data is by using (command "-PropertyDataEdit"....) but obviously it's not possible to use 'command' within a reactor.
 
Is there another method available to edit the data that I can use within a reactor? All I want to be able to do is pass a simple text value to a named key but I'm stuffed if I can suss it out.
 
Thanks in advance.

Keith Brown

  • Swamp Rat
  • Posts: 601
Re: Alternative to (command "-PropertyDataEdit"....)
« Reply #1 on: April 08, 2013, 09:37:44 AM »
What you are looking for is the method Autodesk.Aec.PropertyData.DatabaseServices.PropertySet.SetAt

I am at the airport right now getting ready to board a plane and don't have a code sample ready but it is pretty simple to do.  There are several overloaded methods the easiest being just pass in the objectId of the property set definition and then the value to set.  Something like this.

pset.SetAt(pset.PropertyNameToId("Name"), "PropertySetDefinitionValue");
Keith Brown | AutoCAD MEP Blog | RSS Feed
AutoCAD MEP 2014 / Revit MEP 2014 / EastCoast CAD/CAM addon / Visual Studio 2013

mr_nick

  • Guest
Re: Alternative to (command "-PropertyDataEdit"....)
« Reply #2 on: April 08, 2013, 09:49:18 AM »
That looks suspiciously like DotNet code which I have to admit is still something of a new language for me. I am in the process of picking it up as I really need to harness a bit more power than LISP seems to be able to offer but at this point I was hoping to be able to find a vlax method to edit the content. I'm guessing it is possible because I can attach and read propertyset data but I just can't figure out the syntax to edit it - hopefully it's just that I've been staring at it too long and not because I'm chasing a non-existent goal.

Keith Brown

  • Swamp Rat
  • Posts: 601
Re: Alternative to (command "-PropertyDataEdit"....)
« Reply #3 on: April 08, 2013, 11:16:27 AM »
oops your right, I am in the Lisp forum and didnt realize when i posted from my phone.

There is no other method to manipulate the property set data using LISP.  The -PropertyDataEdit command is the recommended way by Autodesk for LISP users and I believe that I read that from an ADN article from the ADN website.

Can LISP run VBA methods?  If so then maybe you can use a vlax method to run it.  I have no clue on lisp so i am not sure.

Again sorry for posting .net solution in lisp forum.

Keith Brown | AutoCAD MEP Blog | RSS Feed
AutoCAD MEP 2014 / Revit MEP 2014 / EastCoast CAD/CAM addon / Visual Studio 2013

TheMaster

  • Guest
Re: Alternative to (command "-PropertyDataEdit"....)
« Reply #4 on: April 08, 2013, 03:34:46 PM »

Can LISP run VBA methods?  If so then maybe you can use a vlax method to run it.  I have no clue on lisp so i am not sure.


VBA has no 'methods' of it's own, it's merely an ActiveX client. So generally, if there is a way to access an API with VBA, then it can most-likely be done with LISP as well, provided that the COM object being used supports the IDispatch interface, which I believe most Autodesk ActiveX APIs (with the notable exception of the sheet set API), do.