![]() |
【转帖】才鸟大侠:你好!
才鸟大侠:你好!
www.dimcax.com 才鸟大侠:你好! 才鸟大侠:你好!本人是cad.net开发爱好者,会员名:pp18t。可能你还记得。感谢网上对本人问题的回答!我也在写一些自己专业用到的代码。现有一非常重要的问题出现,详见下面代码及问题所在: '--引入cad命名空间省略... public sub testmrr() dim l1, l2 as polyline, base as point3d = new point3d(0, 0, 0), a as double = 8000, b as double = 6000 l1 = new polyline '--画矩形 l1.addvertexat(0, new point2d(base.x, base.y), 0, 0, 0) l1.addvertexat(1, new point2d(base.x + a, base.y), 0, 0, 0) l1.addvertexat(2, new point2d(base.x + a, base.y + b), 0, 0, 0) l1.addvertexat(3, new point2d(base.x, base.y + b), 0, 0, 0) l1.addvertexat(4, new point2d(base.x, base.y), 0, 0, 0) l2 = l1.clone '--画第二个 = 克隆第一个矩形 l2.transformby(matrix3d.mirroring(base)) '--对第二个矩形以base点进行镜像 l2.setpointat(1, new point2d(1000, 1000)) '--改变第二个矩形的顶点(1)到(1000,1000) '--以下将这两个矩形加入数据库 dim trs as transaction = db.transactionmanager.starttransaction() doclock = application.documentmanager.mdiactivedocument.lockdocument() db = hostapplicationservices.workingdatabase bt = trs.getobject(db.blocktableid, openmode.forread) btr = trs.getobject(bt.item(blocktablerecord.modelspace), openmode.forwrite) l2.onsegmentat(1, new point2d(), 0) try btr.appendentity(l1) trs.addnewlycreateddbobject(l1, true) btr.appendentity(l2) trs.addnewlycreateddbobject(l2, true) trs.commit() catch finally trs.dispose() end try doclock.dispose() '★★★主要问题: '--实际结果是: 矩形l2的顶点(1)移动到了点(-1000,1000),而并没有移动到(1000,1000)。这是为什么? '--**本以为画多个相同的矩形可以使用变换的方法简单得到,但却的不到正确的结果,十分不解!!郁闷啊 '实际上,对矩形l2的许多操作都出现了错误。如: '★ l2.onsegmentat(1, new point2d(-4000,0), 0) 函数的结果始终为 false,可实际上该点在l2的第1段上; '★ l2.getlinesegment2dat()、 l2.getarcsegment2dat()函数的结果均不正确,他们的位置实际上在矩形l1的对应位置上; '万望给予解答!本人不胜感激。 '可与本人联系: end sub |
所有的时间均为北京时间。 现在的时间是 04:35 PM. |