.NET

Reply
*Tony Tanzillo
Message 11 of 17 (1,006 Views)

Re: Dynamic block question

03-01-2010 12:00 PM in reply to: gagangajabaharia
What you need isn't available via any documented API, I'm afraid.

You can get it, but it requires the use of acdbEntGet() (which you
have to P/Invoke from managed code).

Attached is a screen grab showing the DXF fields for the object
that stores the visibility states for a dynamic block. That object
is buried in the dynamic block def's extension dictionary, and
is an instance of an "AcDbBlockVisibilityParameter" (that's the
native ObjectARX class and the runtime class name, it's not the
managed wrapper type).

The right side shows the DXF fields for that object, and you can
see the DXF fields for a single visiblity state. The 303 string is the
name of the visiblity state. The next item (code 94) is an integer
that holds the number of ObjectIds that immediately follow, which
are the ids of the block entities that are explicitly visible in that state.

The DXF data for the AcDbBlockVisibilityParameter contains this
same set of fields for each visibility state. Since there can only be
a single visibility state for each dynamic block, you can just seek
the DXF data of the owner object to locate it's ObjectId, and then
call acdbEntGet() on that, to get the visibility state data.

So, the steps are:

1. Get the BlockTableRecord for the dynamic block definition.

2. Get the extension dictionary for the BlockTableRecord.

3. Get ObjectId of the "ACAD_ENHANCEDBLOCK" entry in
the extension dictionary.

4. call acdbEntGet() on ObjectId obtained in step 3, which
returns a ResultBuffer containing TypedValues.

5. Iterate over the TypedValues looking for an item whose group
code is 360, and get the ObjectId stored in the TypedValue's
Value property, then get value of the 'Name' property of the
ObjectId's ObjectClass property, and see if it equals the string
"AcDbBlockVisibilityParameter".

6. Once you've found the AcDbBlockVisibilityParameter object's
ObjectId, call acdbEntGet() on it, and data like that shown on
the right side of the screen grab is returned in a ResultBuffer.

7. Iterate over the TypedValues in the ResultBuffer returned by
acdbEntGet(), looking for an item whose group code is 303,
and whose string value equals the name of the visibility group.

8. Get the next element from the ResultBuffer, which is a 94
group code whose value is the number of ObjectIds that
follow, and then read that many subsequent items having a
group code of 331, and collect the ObjectIds in each into a
list, and you then have the ObjectIds of the block entities
that are explicitly visible in the visiblity state.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6346232@discussion.autodesk.com...
Sorry for the late response - I had forgotten to mark "Watch this thread".

Yes Tony, that is exactly what I am trying to get at : what entities are visible
for a given visibility state of a dynamic block.

Thank you, Gagan
Contributor
gagangajabaharia
Posts: 13
Registered: ‎01-29-2010
Message 12 of 17 (1,006 Views)

Re: Dynamic block question

03-01-2010 12:19 PM in reply to: gagangajabaharia
Thanks, Tony for the detailed explanation. If this is the only way, I will have to bite the bullet and go that way - I am sure I will questions along the way.

Thanks, Gagan

> {quote:title=Guest wrote:}{quote}
> What you need isn't available via any documented API, I'm afraid.
>
> You can get it, but it requires the use of acdbEntGet() (which you
> have to P/Invoke from managed code).
>
> Attached is a screen grab showing the DXF fields for the object
> that stores the visibility states for a dynamic block. That object
> is buried in the dynamic block def's extension dictionary, and
> is an instance of an "AcDbBlockVisibilityParameter" (that's the
> native ObjectARX class and the runtime class name, it's not the
> managed wrapper type).
>
*Darren J. Young
Message 13 of 17 (1,006 Views)

Re: Dynamic block question

03-12-2010 11:10 AM in reply to: gagangajabaharia

If you need something quick and dirty and don't
have the time or desire to put forth that type of effort, simply copy the a
dynamic block instance using that visibility state and explode it, examine the
resulting geometry, then delete it once you've examined it.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Thanks,
Tony for the detailed explanation. If this is the only way, I will have to
bite the bullet and go that way - I am sure I will questions along the way.
Thanks, Gagan > {quote:title=Guest wrote:}{quote} > What you need isn't
available via any documented API, I'm afraid. > > You can get it, but it
requires the use of acdbEntGet() (which you > have to P/Invoke from managed
code). > > Attached is a screen grab showing the DXF fields for the
object > that stores the visibility states for a dynamic block. That object
> is buried in the dynamic block def's extension dictionary, and > is an
instance of an "AcDbBlockVisibilityParameter" (that's the > native
ObjectARX class and the runtime class name, it's not the > managed wrapper
type). >
*Tony Tanzillo
Message 14 of 17 (1,006 Views)

Re: Dynamic block question

03-12-2010 01:29 PM in reply to: gagangajabaharia
{quote}

If you need something quick and dirty and don't have the time or desire to put
forth that type of effort, simply copy the a dynamic block instance using that
visibility state and explode it, examine the resulting geometry, then delete it
once you've examined it.

{quote}

I don't think that would work, because there's nothing in the entities produced
by exploding the dynamic block that tells what entities are associated with a
given visibility state. IOW, not all visible entities in a dynamic block need to
be associated with a visibility state.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"Darren J. Young" wrote in message
news:6354065@discussion.autodesk.com...
If you need something quick and dirty and don't have the time or desire to put
forth that type of effort, simply copy the a dynamic block instance using that
visibility state and explode it, examine the resulting geometry, then delete it
once you've examined it.
wrote in message news:6346482@discussion.autodesk.com...
Thanks, Tony for the detailed explanation. If this is the only way, I will
have to bite the bullet and go that way - I am sure I will questions along the
way. Thanks, Gagan > {quote:title=Guest wrote:}{quote} > What you need isn't
available via any documented API, I'm afraid. > > You can get it, but it
requires the use of acdbEntGet() (which you > have to P/Invoke from managed
code). > > Attached is a screen grab showing the DXF fields for the object >
that stores the visibility states for a dynamic block. That object > is buried
in the dynamic block def's extension dictionary, and > is an instance of an
"AcDbBlockVisibilityParameter" (that's the > native ObjectARX class and the
runtime class name, it's not the > managed wrapper type). >
*Darren J. Young
Message 15 of 17 (1,006 Views)

Re: Dynamic block question

03-18-2010 07:05 AM in reply to: gagangajabaharia
{quote}
I don't think that would work, because there's nothing in the entities
produced
by exploding the dynamic block that tells what entities are associated with
a
given visibility state. IOW, not all visible entities in a dynamic block
need to
be associated with a visibility state.
{quote}

Good point Tony and an important nuance to the question..Are they looking
for the entities visible when a given visibility state or entities that are
actually associated to particular visibility state as visible.
*Tony Tanzillo
Message 16 of 17 (1,006 Views)

Re: Dynamic block question

03-18-2010 02:27 PM in reply to: gagangajabaharia
The way I read it, the OP wanted to know what entities
are associated with a given visibility state.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"Darren J. Young" wrote in message
news:6356789@discussion.autodesk.com...
{quote}
I don't think that would work, because there's nothing in the entities
produced
by exploding the dynamic block that tells what entities are associated with
a
given visibility state. IOW, not all visible entities in a dynamic block
need to
be associated with a visibility state.
{quote}

Good point Tony and an important nuance to the question..Are they looking
for the entities visible when a given visibility state or entities that are
actually associated to particular visibility state as visible.
Active Contributor
jcheard
Posts: 39
Registered: ‎10-03-2007
Message 17 of 17 (913 Views)

Re: Dynamic block question

10-28-2010 09:51 AM in reply to: *Tony Tanzillo

Tony,

 

I'm trying to do the same thing but Step 4 Returns nothing.  however, I can clearly see using ArxDbg that there should be a Result Buffer returned.  What could cause this not to work? 

 

BTW -- I'm using AutoCAD 2009 - Service Pack 4

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