Author Topic: AttSync in ODBX doc  (Read 2062 times)

0 Members and 1 Guest are viewing this topic.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
AttSync in ODBX doc
« on: November 09, 2016, 10:59:03 AM »
In a ODBX doc I can "insert" a block with (vlax-invoke DbxDoc 'copyobjects ObjLst BlkObj) from other ODBX doc to update existing block.
Question: if the block has attributes in different number, name or position is there any way to update the block as with AttSync command?

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: AttSync in ODBX doc
« Reply #1 on: November 09, 2016, 01:32:52 PM »
Hi,

I do not code so much with AutoLISP these days, but I have reproduced the process executed by the ATTSYNC command with .NET.

Pseudo code:

Get the block definition
Get all the attribute definitons in the block definition
Foreach block reference inserted in the drawing
  Store the attributes values in an assoc list (tag . value)
  Erase the all attribute references
  Foreach attribute definition
    Add a new attribute reference to the block reference attribute collection
    Set the attribute reference properties according to the attribute definition ones
    Set the attribute reference geometry according to the block reference one (insertion point, scale, rotation)
    Set the attribute reference value according to the stored ones
Speaking English as a French Frog

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: AttSync in ODBX doc
« Reply #2 on: November 09, 2016, 03:01:55 PM »
Hi,

I do not code so much with AutoLISP these days, but I have reproduced the process executed by the ATTSYNC command with .NET.

Pseudo code:

Get the block definition
Get all the attribute definitons in the block definition
Foreach block reference inserted in the drawing
  Store the attributes values in an assoc list (tag . value)
  Erase the all attribute references
  Foreach attribute definition
    Add a new attribute reference to the block reference attribute collection
    Set the attribute reference properties according to the attribute definition ones
    Set the attribute reference geometry according to the block reference one (insertion point, scale, rotation)
    Set the attribute reference value according to the stored ones
Thanks for answer, I try to translate your code in Lisp... maybe it will be also useful for this problem: https://www.theswamp.org/index.php?topic=52209.0
Buona notte.