[lisp] entmod and Table

I've got a table (possibly imported). Text style for each cell is redefined and in output of entget there is a pair (7 . "style1") for each cell.
I try to change text style in cells using code like this

(setq 
   enty (entget (car (entsel)))
   newent nil
   newstyle "style2"
)

(foreach elem enty
   (if (= (car elem) 7)
      (setq elem (cons 7 newstyle))
   )
   (setq newent (append newent (list elem)))
)

(entmod newent)

Finally newent contain same data as enty with replaced pairs (7 . "style2"). But entmod don't modify the table in drawing.

What do I do wrong?

Comments

  • Roy Klein Gebbinck
    edited July 2018

    I can confirm this issue. You cannot use entmod here. But the vla-setcelltextstyle function works just fine.

  • gesselt
    edited July 2018

    Unfortunately attempt to use (vla-setcelltextstyle) on Linux leads to "error : no function definition VLA-SETCELLTEXTSTYLE"

  • Roy Klein Gebbinck
    edited July 2018

    I see that this function is not yet included in the 'FAST-COM' implementation. So it is only available in the Windows version. It may be wise to send in a feature request.

    This workaround may be worth trying:

    1. Change the SAVEROUNDTRIP setting to 0 (zero).
    2. Create a temporary DXF file: (command "_.dxfout" fileName "_entities" ...).
    3. Modify the file programmatically. Note that each table has an attached block definition that also must be modified.
    4. Insert the DXF and explode the block.
    5. Erase the original table.
This discussion has been closed.