几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】hatch creation (http://www.dimcax.com/hust/showthread.php?t=16469)

yang686526 2009-05-05 11:50 AM

【转帖】hatch creation
 
hatch creation
hatch creation
i have oddb entity and want to create hatch for those entity .. could any one please guide me how to do that in vc++ with a small sample code.
thanks in advance
i can tell you how to make a solid hatch.
iacadlwpolyline pline = null;
try
{
double[] trimmedvertices = trimverticelist(vertices); // remove last point if it is equal to first point.
pline = acdocument.modelspace.addlightweightpolyline( trimmedvertices);
if (vertices.length >= 4 * 2) // only hatch things that actually has an area
{
pline.closed = true;
iacadentity[] outerloop = new iacadentity[1];
outerloop[0] = pline;
iacadhatch currenthatch = acdocument.modelspace.addhatch( (int)acpatterntype.achatchpatterntypepredefined,
"solid",
true,
system.runtime.interopservices.varenum.vt_error);
currenthatch.appendouterloop(outerloop);
currenthatch.visible = true;
currenthatch.evaluate();
}
}
catch (exception come)
{
system.console.writeline(come);
}
to make a non-solid hatch i try to use "ansi31", but patternspace fails (see other thread):
iacadhatch currenthatch = acdocument.modelspace.addhatch( (int)acpatterntype.achatchpatterntypepredefined,
"ansi31",
true,
system.runtime.interopservices.varenum.vt_error );
currenthatch.appendouterloop(outerloop);
currenthatch.patternangle = 0;
currenthatch.patternspace = double.parse(exporthatchdenseness);
//currenthatch.patternscale = double.parse(exporthatchdenseness) * 100;
currenthatch.visible = true;
currenthatch.evaluate();
pattern name for userdefined
a colleague of mine figured this out: use "_user" instead of "ansi31".
best regards
michael
thank you very much


所有的时间均为北京时间。 现在的时间是 06:45 PM.