Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
cbenner
Posts: 3,132
Registered: ‎04-06-2010
Message 1 of 7 (343 Views)
Accepted Solution

Looking for advice or help, haven't done lisp in years!

343 Views, 6 Replies
08-29-2013 08:39 AM

Ok,... more like decades... probably been 15 years at least since I've done ANY lisp and Autocad has changed a bit since then.

 

I've been up and down the forums looking for some direction or programming code for this to no avail.

 

What I'd like to do is edit a table where the cells are populated with fields.  I'd like to copy the last row of the table to a new row (fields and all), then change the fields of the row I copied FROM to text, and lock those cells.  See image....

 

demo.JPG

 

So, in this image, I'd like to copy this row including the fields to a new row beneath it.  Then edit the cells of the first row to change the fields to text, and then finally lock the cells of the first row so that only the new row would update when the field properties change.  Eventually they will be populated with data from the Vault... but first things first.

 

Anyone have any ideas?

ChrisB

ADSK_Expert_Elite_Icon_S_Color_Blk.png

Please use Mark Solutions!.Accept as Solution &Give Kudos!Kudos to further enhance the value of these forums. Thank you! :smileyhappy:

http://cbennertipstricks.blogspot.com/


   

*Expert Elite*
dbroad
Posts: 1,480
Registered: ‎08-16-2007
Message 2 of 7 (282 Views)

Re: Looking for advice or help, haven't done lisp in years!

08-30-2013 06:40 AM in reply to: cbenner

Why do this first?  Wouldn't dataextraction or just the basic table command do with an external source?  Use excel and populate your data.  What are the fields for?  Dataextraction can pull a table straight from the properties of objects.

 

The last thing I would do would be to try to programmatically build tables with LISP.  Its a complex task.  If you must, try googling "tables autolisp"

*Expert Elite*
cbenner
Posts: 3,132
Registered: ‎04-06-2010
Message 3 of 7 (267 Views)

Re: Looking for advice or help, haven't done lisp in years!

08-30-2013 07:46 AM in reply to: dbroad

The fields in this table are populated from Vault.  I want to populate the current row from Vault properties, copy the row including all of the fields, and then convert the original row's fields to text so they will not change when I modify the Vault properties later.  Locking the cells may not be necessary, but it would be added security.

 

Yes... the Vault Revision table does this... but I need to create something that works just like to VRT... from the Item Master side of Vault.

 

Basically trying to get Vault and Autocad to do something they were never meant to do.

ChrisB

ADSK_Expert_Elite_Icon_S_Color_Blk.png

Please use Mark Solutions!.Accept as Solution &Give Kudos!Kudos to further enhance the value of these forums. Thank you! :smileyhappy:

http://cbennertipstricks.blogspot.com/


   

*Expert Elite*
Lee_Mac
Posts: 1,109
Registered: ‎12-29-2009
Message 4 of 7 (263 Views)

Re: Looking for advice or help, haven't done lisp in years!

08-30-2013 08:07 AM in reply to: cbenner

Try the following quick draft based on your image:

 

(defun c:tabmod ( / col obj )
    (if (setq obj (ssget "_+.:E:S:L" '((0 . "ACAD_TABLE"))))
        (progn
            (setq obj (vlax-ename->vla-object (ssname obj 0)))
            (vla-insertrows obj 1 (vla-getrowheight obj 1) 1)
            (repeat (setq col (vla-get-columns obj))
                (vla-settext obj 1 (setq col (1- col)) (vla-gettext obj 2 col))
            )
        )
    )
    (princ)
)
(vl-load-com) (princ)

 

Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)
Expert Elite
With Mathematics there is the possibility of perfect rigour, so why settle for less?
*Expert Elite*
Lee_Mac
Posts: 1,109
Registered: ‎12-29-2009
Message 5 of 7 (257 Views)

Re: Looking for advice or help, haven't done lisp in years!

08-30-2013 08:22 AM in reply to: Lee_Mac

Or, try the following:

 

(defun c:tabmod ( / c i o r s )
    (if (setq s (ssget "_:L" '((0 . "ACAD_TABLE"))))
        (repeat (setq i (sslength s))
            (setq o (vlax-ename->vla-object (ssname s (setq i (1- i))))
                  r (1- (vla-get-rows o))
            )
            (vla-insertrows o r (vla-getrowheight o r) 1)
            (repeat (setq c (vla-get-columns o))
                (vla-settext o r (setq c (1- c)) (vla-gettext o (1+ r) c))
                (vla-setcellstate o r c accellstatecontentlocked)
            )
        )
    )
    (princ)
)
(vl-load-com) (princ)

 

The above will operate on the last row for multiple tables in a selection, and will also lock the cells as required.

Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)
Expert Elite
With Mathematics there is the possibility of perfect rigour, so why settle for less?
*Expert Elite*
cbenner
Posts: 3,132
Registered: ‎04-06-2010
Message 6 of 7 (250 Views)

Re: Looking for advice or help, haven't done lisp in years!

08-30-2013 08:31 AM in reply to: Lee_Mac

Absolute genius my good man!  This did exactly what I was looking for!  If I could give more than one kudo, I would do it.

 

I swear, i need to get back into the programming side, this is just too much fun.

 

Thank you!

ChrisB

ADSK_Expert_Elite_Icon_S_Color_Blk.png

Please use Mark Solutions!.Accept as Solution &Give Kudos!Kudos to further enhance the value of these forums. Thank you! :smileyhappy:

http://cbennertipstricks.blogspot.com/


   

*Expert Elite*
Lee_Mac
Posts: 1,109
Registered: ‎12-29-2009
Message 7 of 7 (226 Views)

Re: Looking for advice or help, haven't done lisp in years!

08-30-2013 04:27 PM in reply to: cbenner

Thank you for your kind words Chris, I'm glad the program was helpful and I appreciate your gratitude for my time :smileyhappy:

 

Programming is indeed incredibly fun and highly addictive - be warned, you may get hooked!

Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)
Expert Elite
With Mathematics there is the possibility of perfect rigour, so why settle for less?

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community