- UID
- 5280
- 积分
- 9466
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-18
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
How to create an Mline using ObjectARX?
问题:
How do I create an MLINE entity in AutoCAD using ObjectARX? When I try this, an
MLINE is not created and an error message does not occur indicating this was
unsuccessful.
解答:
The most likely cause for this is that you did not set the MLINE style to the
MLINE entity as it was created.
If an MLINE style is not set, AutoCAD does not know how to visually represent
the MLINE despite the fact that the MLine entity is valid and is appended to the
DWG database.
The following code creates an MLINE using the "Standard" MLINE style that is
always present in any DWG database.
NOTE: You can also create another MLINE style using the AcDbMlineStyle ARX
class.
- AcDbMline *l =new AcDbMline ;
- l->setNormal (AcGeVector3d (0, 0, 1)) ;
- l->setScale (1.5) ;
- AcDbDictionary *d ;
- acdbHostApplicationServices ()->workingDatabase ()
- ->getNamedObjectsDictionary (d, AcDb::kForRead) ;
- AcDbDictionary *ls ;
- d->getAt ("ACAD_MLINESTYLE", (AcDbObject*&)ls, AcDb::kForRead) ;
- d->close () ;
- AcDbObjectId id ;
- ls->getAt ("Standard", id) ;
- ls->close () ;
- l->setStyle (id) ;
- l->appendSeg (AcGePoint3d (0, 0, 0)) ;
- l->appendSeg (AcGePoint3d (10, 0, 0)) ;
- l->appendSeg (AcGePoint3d (10, 10, 0)) ;
- l->appendSeg (AcGePoint3d (20, 20, 0)) ;
- l->appendSeg (AcGePoint3d (20, 100, 0)) ;
- // Now, the AcDbMline entity is ready to be appended to the DWG database
|
|