Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TABLE not updating attribute values through lisp attached

6 REPLIES 6
Reply
Message 1 of 7
coolkris
254 Views, 6 Replies

TABLE not updating attribute values through lisp attached

Dear Sir/ Madam,

 

The dynamic block and attached attributes does not got transferred into tables.  Only one table is updating all the footings attached. Please give solution.

Attached block f1

attached lisp atts2table.lsp

 

Thanks

 

Krish

 

 

Labels (1)
6 REPLIES 6
Message 2 of 7
ec-cad
in reply to: coolkris

I don't see the attachments ? Did they get uploaded ?

 

ECCAD

Message 3 of 7
coolkris
in reply to: coolkris

Please find attached.

Thanks

Message 4 of 7
ec-cad
in reply to: coolkris

For the lisp to work, you would need a 'Table' to pick the first cell from.

Your F1 block (contains) the Table object and only (2) Attributes, both with a tagname of "A".

To surface the Table as a seperate object, you would need to 'Explode' the Block F1, but

when you do that, the F1 Attributes and the remaining lines, text are ATTDEF's and they won't

be associated with the Block that (was) called F1. Therefore, in the Lisp, it wants you to pick

an Attribute from F1, and then pick the first cell of the Table. So when you explode the F1 block,

to expose the Table, all of the items in the Footing layout are just 'Text' 'Attdefs' and 'Polylines'..

So, to fix it, you need to insert a Table, and then insert the Footing, with attributes.

Maybe Lee Mack (whom wrote most of the Lisp program) might know the answer.

 

ECCAD

Message 5 of 7
ec-cad
in reply to: coolkris

Here is a test drawing. I broke out the Table as Block Table1, and the Footing portion of block F1, and

made up a block called Footing1. See the comment in the test drawing.

Basically, you insert the Table, then explode it. Then, insert the Footing block.

Then, load and run the Atts2Table.lsp as before. Should populate the first (2) fields.

 

Cheers,

 

ECCAD

Message 6 of 7
coolkris
in reply to: coolkris

Thanks

Once exploded block loses dynamism.

another version attached here. The table updated

block f1 inserted individually size changed as per parametric values. then exploded using atts2table populated.

But for footing size (width,length and thickness) , I have to create attributes similar to bar do you have any idea where can I place attribute. So I can extract one go and populate table.

 

Thanks

 

Krish

Message 7 of 7
Sea-Haven
in reply to: ec-cad

I have defun code maketable that does just that it is modified to suit rows and columns text height etc and makes a new style of the user's table so for next table just use correct table style. No need for a block or explode.

 

I am sure your capable of doing that code but here it is anyway for anyone else.

 

 

 

 

(defun CreateTableStyle ( / dicts dictobj key class custobj )
    
;; Get the Dictionaries collection and the TableStyle dictionary
(setq dicts (vla-get-Dictionaries (vla-get-ActiveDocument(vlax-get-acad-object))))
(setq dictObj (vla-Item dicts "acad_tablestyle"))

(vlax-for dname dictobj
  (if (=  (vla-get-name dname) "clientname" ) ; does it exist
   (setq clientname "No")
  )
)

(if (= clientname "No")
(progn

;; Create a custom table style
(setq key "clientname" class "AcDbTableStyle")
(setq custObj (vla-AddObject dictObj key class))

;; Set the name and description for the style
(vla-put-Name custObj "clientname")
(vla-put-Description custObj "clientname custom table style")

;; Sets the bit flag value for the style
(vla-put-BitFlags custObj 1)

;; Sets the direction of the table, top to bottom or bottom to top
(vla-put-FlowDirection custObj acTableTopToBottom)

;; Sets the horizontal margin for the table cells
(vla-put-HorzCellMargin custObj (* txtht 0.1))

;; Sets the vertical margin for the table cells
(vla-put-VertCellMargin custObj (* txtht 0.2))

;; Set the alignment for the Data, Header, and Title rows
(vla-SetAlignment custObj (+ acDataRow acHeaderRow acTitleRow) acMiddleCenter)

;; Set the text height for the Title, Header and Data rows
(vla-SetTextHeight custObj acDataRow txtht)
(vla-SetTextHeight custObj acHeaderRow (* txtht 1.2))
(vla-SetTextHeight custObj acTitleRow (* txtht 1.5))

;; Set the text height and style for the Title row
(vla-SetTextStyle custObj (+ acDataRow acHeaderRow acTitleRow) "Standard")

; (vla-put-regeneratetablesuppressed custobj :vlax-false)
)
)
)

 

 

 

 

 

(setq txtht 0.7)
(createtablestyle)
(setvar 'ctablestyle "clientname")
(setq sp (vlax-3d-point (getpoint "pick a point for table")))

(setq numrows 3)
(setq numcolumns 3)
(setq rowheight 1.0)
(setq colwidth 3)
(setq objtable (vla-addtable (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) sp numrows numcolumns rowheight colwidth))
(vla-settext objtable 0 0 "BBQ")
(vla-settext objtable 1 0 "Layername") 
(vla-settext objtable 1 1 "Tot Area (m2)") 
(vla-settext objtable 1 2 "Tot. Length (m)")

 

 

 

 

 

 

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

Post to forums  

Autodesk Customer Advisory Groups


Autodesk Design & Make Report