Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Contributor
dhaverstick
Posts: 22
Registered: ‎01-12-2004
Message 1 of 5 (300 Views)

Problem Getting AcadBlockReference Object

300 Views, 4 Replies
10-25-2004 07:03 AM
Has anyone else had problems getting an AcadBlockReference object by setting it this way: Set AcadBlockRef = ModelSpaceObj.Item("AcadBlockRefName") where "AcadBlockRefName" is the name of the block reference object. Sometimes this method works and sometimes it doesn't. The only way I can get the BlockRef object 100% of the time is by iterating through all the items in Modelspace like this
For Each EntityObj in ModelSpaceObj
If TypeOf EntityObj is AcadBlockReference Then
Set AcadBlockRef = EntityObj
If AcadBlockRef.Name = "AcadBlockRefName" Then
Exit For
Endif
Next


Thanks,

Darren
*Tony Tanzillo
Message 2 of 5 (300 Views)

Re: Problem Getting AcadBlockReference Object

10-25-2004 07:08 AM in reply to: dhaverstick
Where did you get the idea that the Item method accepts the name of a block reference? It doesn't. Common sense would suggest that since there can be more than one insertion of a block of a given name, that you could not use the name as an index key. -- http://www.caddzone.com AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005 http://www.acadxtabs.com "dhaverstick" wrote in message news:9442839.1098713061273.JavaMail.jive@jiveforum1.autodesk.com... > Has anyone else had problems getting an AcadBlockReference object by > setting it this way: Set AcadBlockRef = > ModelSpaceObj.Item("AcadBlockRefName") where "AcadBlockRefName" is the > name of the block reference object. Sometimes this method works and > sometimes it doesn't. The only way I can get the BlockRef object 100% of > the time is by iterating through all the items in Modelspace like this > For Each EntityObj in ModelSpaceObj > If TypeOf EntityObj is AcadBlockReference Then > Set AcadBlockRef = EntityObj > If AcadBlockRef.Name = "AcadBlockRefName" Then > Exit For > Endif > Next > > > Thanks, > > Darren
*Jason Piercey
Message 3 of 5 (300 Views)

Re: Problem Getting AcadBlockReference Object

10-25-2004 08:07 AM in reply to: dhaverstick
In addition to any replies you might receive or already received, you may find more information or responses by posting future VBA related questions in the following discussion group: By NNTP discussion group reader at news://discussion.autodesk.com/autodesk.autocad.customization.vba By HTTP (web-based) interface at http://discussion.autodesk.com/forum.jspa?forumID=33 -- Autodesk Discussion Group Facilitator "dhaverstick" wrote in message news:9442839.1098713061273.JavaMail.jive@jiveforum1.autodesk.com... > Has anyone else had problems getting an AcadBlockReference object by setting it this way: Set AcadBlockRef = ModelSpaceObj.Item("AcadBlockRefName") where "AcadBlockRefName" is the name of the block reference object. Sometimes this method works and sometimes it doesn't. The only way I can get the BlockRef object 100% of the time is by iterating through all the items in Modelspace like this > For Each EntityObj in ModelSpaceObj > If TypeOf EntityObj is AcadBlockReference Then > Set AcadBlockRef = EntityObj > If AcadBlockRef.Name = "AcadBlockRefName" Then > Exit For > Endif > Next > > > Thanks, > > Darren
Contributor
dhaverstick
Posts: 22
Registered: ‎01-12-2004
Message 4 of 5 (300 Views)

Re: Problem Getting AcadBlockReference Object

10-25-2004 09:17 AM in reply to: dhaverstick
1) In my particular case, all block reference objects have unique names. 2) I got the idea of setting object references using the Item method from this discussion group. I tried it and it worked in my test case.
*Doug Broad
Message 5 of 5 (300 Views)

Re: Problem Getting AcadBlockReference Object

10-25-2004 10:21 AM in reply to: dhaverstick
You can use the name form of the item method on the block collection but I am sure the name form does not work in the modelspace collection. Why not use filtered selection sets? Regards, Doug "dhaverstick" wrote in message news:15958284.1098721080141.JavaMail.jive@jiveforum1.autodesk.com... > 1) In my particular case, all block reference objects have unique names. 2) I got the idea of setting object references using the Item method from this discussion group. I tried it and it worked in my test case.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.