明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: chpmould

[基础] 实现填充和图块例子

  [复制链接]
 楼主| 发表于 2010-12-9 20:03 | 显示全部楼层
谢谢老师,问题终于解决了...
发表于 2012-10-15 00:09 | 显示全部楼层
您好,请问您是怎么解决的啊,能给段代码看看吗,这个问题我也纠结了好久了
发表于 2012-10-15 16:54 | 显示全部楼层
雪山飞狐_lzh 发表于 2010-12-8 13:52

狐哥,我想定义填充色的边界,即一个外边界,一个内边界,为什么这样填充没有效果啊List<Entity> loopents = new List<Entity> { new Circle(new Point3d(0, 0, 0), Vector3d.ZAxis, 3) };
                    ObjectIdCollection loopids = new ObjectIdCollection(loopents.Select(ent => AddEntity(tr, blkdef, ent)).ToArray());
                    List<Entity> loopents1 = new List<Entity> { new Circle(new Point3d(0, 0, 0), Vector3d.ZAxis, 1.5) };
                    ObjectIdCollection loopids1 = new ObjectIdCollection(loopents1.Select(ent => AddEntity(tr, blkdef, ent)).ToArray());
Hatch acHatch = new Hatch();
                    acHatch.SetDatabaseDefaults();
                    acHatch.HatchObjectType = HatchObjectType.GradientObject;
                    acHatch.SetGradient(GradientPatternType.PreDefinedGradient, "SPHERICAL");
                    // We're defining two colours
                    acHatch.GradientOneColorMode = false;
                    GradientColor[] gcs = new GradientColor[2];
                    gcs[0] = new GradientColor(Color.FromRgb(213, 213, 210), 0);
                    gcs[1] = new GradientColor(Color.FromRgb(255, 255, 255), 1);
                    acHatch.SetGradientColors(gcs);
                    acHatch.Elevation = 0;
                    acHatch.Associative = false;
                    acHatch.HatchStyle = HatchStyle.Outer;
                    acHatch.AppendLoop(HatchLoopTypes.Outermost, loopids);
                    acHatch.AppendLoop(HatchLoopTypes.Default, loopids1);
                    acHatch.EvaluateHatch(true);
                    //loopents.ForEach(ent => ent.Erase());
                    List<Entity> ents = new List<Entity> { new Circle(Point3d.Origin, Vector3d.ZAxis, 10), new Line(new Point3d(-15, 0, 0), new Point3d(15, 0, 0)), acHatch };
                    int i = 1;
                    ents.ForEach(ent => { ent.ColorIndex = i++; AddEntity(tr, blkdef, ent); });
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-3 12:17 , Processed in 1.087145 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表