Author Topic: Vla-AddAttribute in Block Inser (IAcadBlockReference)  (Read 3242 times)

0 Members and 1 Guest are viewing this topic.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1454
  • Marco
Vla-AddAttribute in Block Inser (IAcadBlockReference)
« on: December 23, 2016, 03:59:34 AM »
Is it possible with ActiveX add attributes (IAcadAttributeReference) to a Block (IAcadBlockReference) like vla-AddAttribute do with IAcadAttribute and IAcadBlock?



roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Vla-AddAttribute in Block Inser (IAcadBlockReference)
« Reply #1 on: December 23, 2016, 08:06:01 AM »
You probably know the answer already:
You cannot directly create an attribute reference

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1454
  • Marco
Re: Vla-AddAttribute in Block Inser (IAcadBlockReference)
« Reply #2 on: December 23, 2016, 09:26:12 AM »
You probably know the answer already:
You cannot directly create an attribute reference
Thanks again, I was hoping someone had invented a few tricks...  :cry:
The only option is to re-insert the block with vla-insertblock after adding with vla-AddAttribute the IAcadAttribute to the IAcadBlock...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Vla-AddAttribute in Block Inser (IAcadBlockReference)
« Reply #3 on: December 23, 2016, 10:02:34 AM »
The only option is to re-insert the block with vla-insertblock after adding with vla-AddAttribute the IAcadAttribute to the IAcadBlock...

Not entirely true if you step outside the confines of activex. If you walk a block instance's linked list ... gathering the dxf data as you go for the insert, attributes ... add any new desired ATTRIB's dxf data, cap it with a proper SEQEND def, then entmake each entry (after stripping any -1, -2, 5 or 330 entries). Subtitle: you don't have to add the ATTDEFs to the block definition. Yes/Note: the new block instance will not match the block definition. I was using this technique about 20 years ago and it still works -- I  had ATTRIB-less block defs -- adding constant attributes on the fly -- per instance -- as need dictated.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1454
  • Marco
Re: Vla-AddAttribute in Block Inser (IAcadBlockReference)
« Reply #4 on: December 23, 2016, 10:12:59 AM »
The only option is to re-insert the block with vla-insertblock after adding with vla-AddAttribute the IAcadAttribute to the IAcadBlock...

Not entirely true if you step outside the confines of activex. If you walk a block instance's linked list ... gathering the dxf data as you go for the insert, attributes ... add any new desired ATTRIB's dxf data, cap it with a proper SEQEND def, then entmake each entry (after stripping any -1, -2, 5 or 330 entries). Subtitle: you don't have to add the ATTDEFs to the block definition. Yes/Note: the new block instance will not match the block definition. I was using this technique about 20 years ago and it still works -- I  had ATTRIB-less block defs -- adding constant attributes on the fly -- per instance -- as need dictated.
Thanks for the trick, I am looking for a solution for AttSync in Odbx doc see: https://www.theswamp.org/index.php?topic=52255.msg572281#msg572281
Actually I am able to Sync (insertpoint, style, alignment ect...) all attribs but not add the missing ones...

Lee Mac

  • Seagull
  • Posts: 12929
  • London, England
Re: Vla-AddAttribute in Block Inser (IAcadBlockReference)
« Reply #5 on: December 23, 2016, 10:14:34 AM »
The only option is to re-insert the block with vla-insertblock after adding with vla-AddAttribute the IAcadAttribute to the IAcadBlock...

Not entirely true if you step outside the confines of activex. If you walk a block instance's linked list ... gathering the dxf data as you go for the insert, attributes ... add any new desired ATTRIB's dxf data, cap it with a proper SEQEND def, then entmake each entry (after stripping any -1, -2, 5 or 330 entries). Subtitle: you don't have to add the ATTDEFs to the block definition. Yes/Note: the new block instance will not match the block definition. I was using this technique about 20 years ago and it still works -- I  had ATTRIB-less block defs -- adding constant attributes on the fly -- per instance -- as need dictated.
Thanks for the trick, I am looking for a solution for AttSync in Odbx doc see: https://www.theswamp.org/index.php?topic=52255.msg572281#msg572281
Actually I am able to Sync (insertpoint, style, alignment ect...) all attribs but not add the missing ones...

Wouldn't it be easier to delete & re-insert the block reference, configuring the properties & attribute values to match the original?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Vla-AddAttribute in Block Inser (IAcadBlockReference)
« Reply #6 on: December 23, 2016, 10:17:48 AM »
I am looking for a solution for AttSync in Odbx doc see: https://www.theswamp.org/index.php?topic=52255.msg572281#msg572281 ...

Had I known that I wouldn't have polluted the thread; sorry.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1454
  • Marco
Re: Vla-AddAttribute in Block Inser (IAcadBlockReference)
« Reply #7 on: December 23, 2016, 12:24:41 PM »
I am looking for a solution for AttSync in Odbx doc see: https://www.theswamp.org/index.php?topic=52255.msg572281#msg572281 ...

Had I known that I wouldn't have polluted the thread; sorry.
I do not understand very well (idiomatic phrase), however, thanks to all.  :-)