.NET

Reply
*Jimmy Bergmark
Message 11 of 15 (170 Views)

Re: Retrieving boundaries from non-associative hatch

07-24-2005 01:42 AM in reply to: jnelso99
Have you tried using the command -HATCHEDIT and the options to restore the
boundary? It doesn't work on gradient hatches though.

--
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:4909511@discussion.autodesk.com...
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.
Active Member
jnelso99
Posts: 9
Registered: ‎07-21-2005
Message 12 of 15 (170 Views)

Re: Retrieving boundaries from non-associative hatch

07-27-2005 01:59 PM in reply to: jnelso99
I'll look into that command. One question, tho - Is there an automatic, non-interactive version of the command, so that a hatch entity would not need to be explicitly clicked by the user, and something like an object id can just be used instead? I would like this process invisible to the user. Thanks!
*Jimmy Bergmark
Message 13 of 15 (170 Views)

Re: Retrieving boundaries from non-associative hatch

07-28-2005 06:20 AM in reply to: jnelso99
Using AutoLISP:
(command "-hatchedit" ent "B" "P" "Y")
where "ent" points to the object.
Not sure how to call this from .NET though.

--
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:4912895@discussion.autodesk.com...
I'll look into that command. One question, tho - Is there an automatic,
non-interactive version of the command, so that a hatch entity would not
need to be explicitly clicked by the user, and something like an object id
can just be used instead? I would like this process invisible to the user.
Thanks!
Active Member
jnelso99
Posts: 9
Registered: ‎07-21-2005
Message 14 of 15 (170 Views)

Re: Retrieving boundaries from non-associative hatch

07-29-2005 09:43 AM in reply to: jnelso99
Excellent! I think it's going to work! I'm a happy camper! Thanks!

For whoever else needs it, here's more or less how to do this in VB.NET (minus error checking, type checking, imports, etc):

Public Sub ReassociateHatch(ByVal hatchid As Integer, ByVal acadDoc As AcadDocument)

Dim ent As AcadEntity = acadDoc.ObjectIdToObject(hatchid)
Dim cmd As String

cmd = "(command ""-hatchedit"" (handent """ & ent.Handle & """) ""B"" ""P"" ""Y"")" & vbCr
acadDoc.SendCommand(cmd)

End Sub
Active Member
jnelso99
Posts: 9
Registered: ‎07-21-2005
Message 15 of 15 (170 Views)

Re: Retrieving boundaries from non-associative hatch

07-29-2005 03:01 PM in reply to: jnelso99
Ok, I may have spoken too soon about things working - wierd things are happening. I've basically got an MFC application calling a VB.NET library which calls AutoCAD. The VB.NET code does the SendCommand, and by default AutoCAD is set to be not visible (setting the AcadApplication.Visible to false). When my MFC app starts up, everything's ok, and I can load normal files with no problem. When I load one that requires the SendCommand("(command -""hatchedit""...) thing, when that SendCommand is called, the AutoCAD instance becomes visible and pops up. Not a problem - just reset the Visible flag on the AcadApplication again right after the SendCommand.

But what happens is when I load another file after that, I get an error and the AutoCAD instance goes away. The error message I get is "The object invoked has disconnected from its clients". I'm not getting them any more, but once there were message boxes saying exceptions occurred in "AcObjClassImp.arx" and "Acopm.arx".

The other wierd thing is that if I let the AutoCAD instance become visible, or start it off being visible, everything works fine. I'm wondering if there's some error or something that AutoCAD need to tell me about so it pops up.

I can put in code in my app to reconnect if it finds itself disconnected, but I'd rather figure out what I'm doing wrong here.

Edit: Also, the -hatchedit command does not seem to be able to handle hatch entities in block definitions. Bummer. Message was edited by: jnelso99
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.