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 (281 Views)

Problem Getting AcadBlockReference Object

281 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 (281 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 (281 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 (281 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 (281 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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community