.NET

Reply
Active Member
jnelso99
Posts: 9
Registered: ‎07-21-2005
Message 1 of 15 (384 Views)

Retrieving boundaries from non-associative hatch

384 Views, 14 Replies
07-21-2005 11:33 AM
Hello,

We're writing a VB.NET application to perform custom processing on AutoCAD files. The app reads in entities and performs various calculations on them. One of the tasks requires the boundaries from hatch objects, both associative and non-associative. Associative is fine (GetLoopAt function works), but the latter does not (GetLoopAt returns Nothing). I've seen the "HatchB" AutoLisp file floating around and will probably start poking around in that to see what's going on and if it will be of any help, but in the meantime, is there any possible way to get the boundary objects of a non-associative hatch entity via .NET? This is one of those "if it can't be done, the whole project is pretty much shot" kind of thing...

If any other details are needed, please let me know.

Thanks!
Active Member
jnelso99
Posts: 9
Registered: ‎07-21-2005
Message 2 of 15 (384 Views)

Re: Retrieving boundaries from non-associative hatch

07-22-2005 11:20 AM in reply to: jnelso99
Hmm...looks like the only way is to call that Lisp function via a SendCommand call, but how would I get any usable data back to VB Land? Is there a way to populate a string (with the entity data the HatchB command parses) via the Lisp/SendCommand call, dump that string into a custom dictionary or xref or whatever, and have VB read it as a string for further parsing (basically doing whatever Hatchb does only in VB)?

Does any of this make sense, or am I just SOL and have to tell the customer that if they want this to work, they have to fix all of their DWG files?
*Paul Richardson
Message 3 of 15 (384 Views)

Re: Retrieving boundaries from non-associative hatch

07-22-2005 12:13 PM in reply to: jnelso99
have you tried using the hatches bounding box? Works in VBA, I haven't
tried in .net though.

wrote in message news:4909040@discussion.autodesk.com...
Hmm...looks like the only way is to call that Lisp function via a
SendCommand call, but how would I get any usable data back to VB Land? Is
there a way to populate a string (with the entity data the HatchB command
parses) via the Lisp/SendCommand call, dump that string into a custom
dictionary or xref or whatever, and have VB read it as a string for further
parsing (basically doing whatever Hatchb does only in VB)?

Does any of this make sense, or am I just SOL and have to tell the customer
that if they want this to work, they have to fix all of their DWG files?
Active Member
jnelso99
Posts: 9
Registered: ‎07-21-2005
Message 4 of 15 (384 Views)

Re: Retrieving boundaries from non-associative hatch

07-22-2005 01:25 PM in reply to: jnelso99
I need to get the actual boundaries of the hatch, not just the extents. For some reason you're not allowed to do it the normal way with GetLoopAt if the hatch is non-associative. Thanks anyway.
*Paul Richardson
Message 5 of 15 (384 Views)

Re: Retrieving boundaries from non-associative hatch

07-22-2005 03:24 PM in reply to: jnelso99
the bounding box will point you toward the object
cant be to many in the same place
wrote in message news:4909197@discussion.autodesk.com...
I need to get the actual boundaries of the hatch, not just the extents. For
some reason you're not allowed to do it the normal way with GetLoopAt if the
hatch is non-associative. Thanks anyway.
*Paul Richardson
Message 6 of 15 (384 Views)

Re: Retrieving boundaries from non-associative hatch

07-22-2005 04:31 PM in reply to: jnelso99
>and have to tell the customer that if they want this to work, they have to
>fix all of their DWG files?

What if the customer had asked you to reassociate all hatches?

Find Bounding Box of hatch
Find Object whos' Bounding Box Matches
Copy properties of existingHatch, Create new one
Append object to your new hatch
Delete old hatch.

Might be an eaiser way, but I just tested this and it works fine.


wrote in message news:4909040@discussion.autodesk.com...
Hmm...looks like the only way is to call that Lisp function via a
SendCommand call, but how would I get any usable data back to VB Land? Is
there a way to populate a string (with the entity data the HatchB command
parses) via the Lisp/SendCommand call, dump that string into a custom
dictionary or xref or whatever, and have VB read it as a string for further
parsing (basically doing whatever Hatchb does only in VB)?

Does any of this make sense, or am I just SOL and have to tell the customer
that if they want this to work, they have to fix all of their DWG files?
Active Member
jnelso99
Posts: 9
Registered: ‎07-21-2005
Message 7 of 15 (384 Views)

Re: Retrieving boundaries from non-associative hatch

07-22-2005 04:46 PM in reply to: jnelso99
Ah - now I see what you're saying. I'll give that a shot, but I'm not sure if it will work for all of my cases. There are some hatch entities that consist of multiple areas. For example, think of a dashed line drawn out where all of the dashes are included in a single hatch entity. Also, the hatch boundaries tend to consist of individual line segments (AcDbLine entities).

But as I think about it, I have an idea on how to make this work, at least good enough for government work :smileywink: I'm going to put this task aside for a day or two to regain my sanity before tackling it, tho.

I'd still like to know how to be able to call a Lisp function with SendCommand and get some kind of useful result data back to VB, just to satisfy my curiosity, but I think I'm set for now with my immediate problem. I really appreciate your help. Thanks!
*Paul Richardson
Message 8 of 15 (384 Views)

Re: Retrieving boundaries from non-associative hatch

07-22-2005 05:06 PM in reply to: jnelso99
>I'd still like to know how to be able to call a Lisp function with
>SendCommand and get some kind of >useful result data back to VB, just to
>satisfy my curiosity, but I think I'm set for now with my >immediate

How about the userr variables? I assume you can access these in .net

$USERI1 - 5 70 Five integer variables intended for use by third-party
developers
$USERR1 - 5 40 Five real variables intended for use by third-party
developers


wrote in message news:4909345@discussion.autodesk.com...
Ah - now I see what you're saying. I'll give that a shot, but I'm not sure
if it will work for all of my cases. There are some hatch entities that
consist of multiple areas. For example, think of a dashed line drawn out
where all of the dashes are included in a single hatch entity. Also, the
hatch boundaries tend to consist of individual line segments (AcDbLine
entities).

But as I think about it, I have an idea on how to make this work, at least
good enough for government work :smileywink: I'm going to put this task aside for a
day or two to regain my sanity before tackling it, tho.

I'd still like to know how to be able to call a Lisp function with
SendCommand and get some kind of useful result data back to VB, just to
satisfy my curiosity, but I think I'm set for now with my immediate problem.
I really appreciate your help. Thanks!
*Jimmy Bergmark
Message 9 of 15 (384 Views)

Re: Retrieving boundaries from non-associative hatch

07-23-2005 11:06 AM in reply to: jnelso99
Have you considered upgrading to AutoCAD 2006 that has much better
functionality to restore boundaries than my HatchB.lsp?

--
Best Regards, Jimmy Bergmark
CAD and Database Developer Manager at www.pharmadule-emtunga.com
Blog: http://jtbworld.blogspot.com
JTB FlexReport (FLEXnet / FLEXlm report tool) -
http://www.jtbworld.com/jtbflexreport
SmartPurger (Purges automatically) -
http://www.jtbworld.com/?/smartpurger.htm
or download some freeware at http://www.jtbworld.com
More on AutoCAD 2005 and 2006
http://www.jtbworld.com/autocad2005.htm
http://www.jtbworld.com/autocad2006.htm


wrote in message news:4909345@discussion.autodesk.com...
Ah - now I see what you're saying. I'll give that a shot, but I'm not sure
if it will work for all of my cases. There are some hatch entities that
consist of multiple areas. For example, think of a dashed line drawn out
where all of the dashes are included in a single hatch entity. Also, the
hatch boundaries tend to consist of individual line segments (AcDbLine
entities).

But as I think about it, I have an idea on how to make this work, at least
good enough for government work :smileywink: I'm going to put this task aside for a
day or two to regain my sanity before tackling it, tho.

I'd still like to know how to be able to call a Lisp function with
SendCommand and get some kind of useful result data back to VB, just to
satisfy my curiosity, but I think I'm set for now with my immediate problem.
I really appreciate your help. Thanks!
Active Member
jnelso99
Posts: 9
Registered: ‎07-21-2005
Message 10 of 15 (384 Views)

Re: Retrieving boundaries from non-associative hatch

07-23-2005 12:01 PM in reply to: jnelso99
That's what we're using. I haven't found how to get the boundaries through .NET, and everything I've seen on this group hints that it isn't possible withough jumping though lots of hoops. The documented "GetLoopAt" function doesn't seem to do as advertised with non-associative hatches. Most likely I'm doing something wrong, but I've only been working with this stuff for a week.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!