Author Topic: vla-item with attributes  (Read 1178 times)

0 Members and 1 Guest are viewing this topic.

whdjr

  • Guest
vla-item with attributes
« on: October 03, 2005, 01:04:11 PM »
I have a list of AttributeReferences (call it ListA) and reference AttributeReference (call it RefAtt).

How would I use 'vla-item' to return the AttributeReference from ListA that matched the same 'tagstring' with the RefAtt?

Or is there another function I should be using?

MP

  • Seagull
  • Posts: 17685
  • Have thousands of dwgs to process? Contact me.
Re: vla-item with attributes
« Reply #1 on: October 03, 2005, 01:15:33 PM »
vla-item is used on collections, not lists.

IF, and that's a big IF, ListA is a true list of AttributeReference objects and RefAtt is an AttributeReference object then perhaps this ...

Code: [Select]
(setq result
(
(lambda ( / tagstring )
(setq tagstring
(strcase
(vla-get-tagstring
RefAtt
)
)
)
(vl-remove-if-not
'(lambda (attributeReference)
(eq tagstring
(strcase
(vla-get-tagstring
attributeReference
)
)
)
)
ListA
)
)
)
)

Coded blind, so may need massaging.
Engineering Technologist CAD Specialist Programmer Analyst
Design Drafting Document Control Automation.
cadanalyst@fastmail.com https://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

whdjr

  • Guest
Re: vla-item with attributes
« Reply #2 on: October 03, 2005, 01:49:10 PM »
Thanks MP,

I knew I could do it with vl-remove-if-not but thought I could do it better with vla-item.  I'll try to implement your code and see what I get.

Thanks, :-)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10388
Re: vla-item with attributes
« Reply #3 on: October 04, 2005, 07:52:32 AM »
You may find some useful code in this routine.
http://www.theswamp.org/forum/index.php?topic=6741.msg83413#msg83413
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.