.NET

Reply
Valued Contributor
sivashanmugam
Posts: 58
Registered: ‎03-05-2006
Message 1 of 9 (65 Views)

Hatching for an object

65 Views, 8 Replies
03-29-2006 09:33 PM
Hai,

Can any one tell how to use hatching for an object for example a circle

Regards,
N. siva shanmugam.
Valued Contributor
sivashanmugam
Posts: 58
Registered: ‎03-05-2006
Message 2 of 9 (65 Views)

Re: Hatching for an object

03-29-2006 09:35 PM in reply to: sivashanmugam
Hai,

To be more precise how fill a color for a circle using hatching.

Regards,
N. siva shanmugam.
Valued Contributor
sivashanmugam
Posts: 58
Registered: ‎03-05-2006
Message 3 of 9 (65 Views)

Re: Hatching for an object

03-29-2006 11:15 PM in reply to: sivashanmugam
Hai,
Plz provide an example of how to fill a color a circle using hatching.

Regards,
N. Siva shanmugam.
*Paul Richardson
Message 4 of 9 (65 Views)

Re: Hatching for an object

03-30-2006 03:31 AM in reply to: sivashanmugam
http://dictionary.reference.com/search?r=2&q=self-importance

--
gl - Paul
wrote in message news:5126441@discussion.autodesk.com...
Hai,
Plz provide an example of how to fill a color a circle using hatching.

Regards,
N. Siva shanmugam.
Distinguished Contributor
RolandF
Posts: 172
Registered: ‎11-19-2003
Message 5 of 9 (65 Views)

Re: Hatching for an object

03-30-2006 04:21 AM in reply to: sivashanmugam
It is something like this, this should help for the start.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BlockTableRecord btr = (BlockTableRecord)myT.GetObject(db.CurrentSpaceId,
OpenMode.ForWrite, false);



Circle MeasuringPoint = new Circle(InsertPoint, new Vector3d(0, 0, 1),
Radius);

btr.AppendEntity(MeasuringPoint);

myT.AddNewlyCreatedDBObject(MeasuringPoint, true);

ObjectIdCollection IDColl = new ObjectIdCollection();

IDColl.Add(MeasuringPoint.ObjectId);


Hatch MeasuringHatch = new Hatch();

MeasuringHatch.SetHatchPattern(HatchPatternType.PreDefined, "SOLID");

btr.AppendEntity(MeasuringHatch);

myT.AddNewlyCreatedDBObject(MeasuringHatch, true);

MeasuringHatch.Associative = true;

MeasuringHatch.AppendLoop(1, IDColl);

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--
Roland Feletic
schrieb im Newsbeitrag
news:5126398@discussion.autodesk.com...
Hai,

Can any one tell how to use hatching for an object for example a circle

Regards,
N. siva shanmugam.
Valued Contributor
sivashanmugam
Posts: 58
Registered: ‎03-05-2006
Message 6 of 9 (65 Views)

Re: Hatching for an object

03-30-2006 04:56 AM in reply to: sivashanmugam
Hai,

thanks roland its working fine.

But the hatch and circle is taken as a seperate entity when I move with the help of the mouse, but I need both hatch and circle to act as a same entity.

It mean after creating my program when I move the circle with the help of the mouse the hatch should also be moved simultaneously,

Regards,
N. Siva shanmugam.
Distinguished Contributor
RolandF
Posts: 172
Registered: ‎11-19-2003
Message 7 of 9 (65 Views)

Re: Hatching for an object

03-30-2006 06:10 AM in reply to: sivashanmugam
The hatch should be associative. If you move the circle the hatch should
stay in the circle. For me it works.

--
Roland Feletic
Valued Contributor
sivashanmugam
Posts: 58
Registered: ‎03-05-2006
Message 8 of 9 (65 Views)

Re: Hatching for an object

03-30-2006 09:25 PM in reply to: sivashanmugam
Hai

Thanks for the reply and support...

But when I try your code both the hatch and the circle is taking as a seperate entity. I don't where I am going wrong.

Plz check the below code which is what i tried.

Code:
----------
AcadDb.Circle circleobj = new AcadDb.Circle(new Autodesk.AutoCAD.Geometry.Point3d(30, 10, 0),Autodesk.AutoCAD.Geometry.Vector3d.ZAxis, 5);

AcadDb.Database db = AcadApp.DocumentManager.MdiActiveDocument.Database;

Autodesk.AutoCAD.DatabaseServices.Transaction tm = db.TransactionManager.StartTransaction();

Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

try
{
AcadDb.BlockTable bt = (AcadDb.BlockTable)tm.GetObject(db.BlockTableId,AcadDb.OpenMode.ForRead);
AcadDb.BlockTableRecord btr = (AcadDb.BlockTableRecord)tm.GetObject(AcadDb.HostApplicationServices.WorkingDatabase.CurrentSpaceId,AcadDb.OpenMode.ForWrite);

btr.AppendEntity(circleobj);
tm.AddNewlyCreatedDBObject(circleobj,true);

AcadDb.Hatch hatch = new Autodesk.AutoCAD.DatabaseServices.Hatch();

AcadDb.ObjectIdCollection objcol = new Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection ();
objcol.Add(circleobj.ObjectId);
hatch.SetHatchPattern(AcadDb.HatchPatternType.PreDefined, "SOLID");

hatch.ColorIndex = 4;

btr.AppendEntity(hatch);

tm.AddNewlyCreatedDBObject(hatch,true);

hatch.Associative = true;

hatch.AppendLoop(1,objcol);

tm.Commit();





}
catch(Exception ex)
{
throw ex;
}
finally
{
tm.Dispose();
}



Thank you,

Regards,
N. siva shanmugam.
New Member
thiss
Posts: 1
Registered: ‎09-03-2006
Message 9 of 9 (65 Views)

Re: Hatching for an object

09-03-2006 10:50 AM in reply to: sivashanmugam
Hi

Can anyone expand on this and demonstrate the more complex case of a polygon (or more) within a polygon, where the inner ones are not filled

Tks

Thiss
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 or visit the Installation and Licensing Forum to get help installing your software.