填充图案时,会出现“填充图案太密”
用C#做的开发,在对多线段封闭的矩形进行填充时,填充比例不变时(如为0.5),当长宽超过一定值时,会出现“填充图案太密”的错误提示!请问这种情况应该怎么处理呢?填充比例不能改变的!
/// <summary>
/// 图形填充测试
/// </summary>
private void Hatch()
{
string path = Application.StartupPath;
aDocument.Application.Preferences.Files.SupportPath += ";" + path;
IAcadHatch hatch = aDocument.ModelSpace.AddHatch((int)AcPatternType.acHatchPatternTypeUserDefined, "gksy", true, AcHatchObjectType.acHatchObject);
double XPoint = (double)nudXPoint.Value;
double YPoint = (double)nudYPoint.Value;
double height = (double)nudLength.Value;
double width = (double)nudWidth.Value;
double scale = (double)nudScale.Value;
//矩形封闭区域
AcadLWPolyline line = aDocument.ModelSpace.AddLightWeightPolyline(
new double[] { XPoint, YPoint,
XPoint, YPoint + height,
XPoint + width, YPoint + height,
XPoint + width, YPoint });
//封闭多段线
line.Closed = true;
AcadEntity[] array = new AcadEntity[] { line as AcadEntity };
hatch.AppendOuterLoop(array);
hatch.PatternScale = scale;
//显示填充图案
try
{
hatch.Evaluate();
lblMessage.Text = "生成完成!";
}
catch (Exception ex)
{
lblMessage.Text = ex.Message;
}
lblMessage.Visible = true;
}
(setenv "MaxHatch" "10000000")
这个是 lisp的做法,C#也应该是类似的吧。 封装类到AutoCAD 2012应该还是没有提供读写AutoCAD环境变量的专用函数,不过AutoCAD环境变量的读写也就是注册表的读写,比如在HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R17.1\ACAD-6001:804\FixedProfile\General写入MaxHatch键,键值为"10000000",即等同于楼上的Lisp语句. 貌似很强大啊! 最简单的方法是把你的scale设置大一些
页:
[1]