ObjectARX创建带文字的线型实例代码

作者: admin 分类: C++,CAD,ObjectARX 发布时间: 2019-11-07 09:39
AcDbLinetypeTable* pLinetypeTable=NULL;
        Acad::ErrorStatus es = acdbHostApplicationServices()->workingDatabase()->getLinetypeTable(pLinetypeTable,AcDb::kForWrite);
        if (Acad::eOk != es)
        {
            return;
        }
        AcDbObjectId txtStyleId=acdbHostApplicationServices()->workingDatabase()->textstyle();
        AcDbLinetypeTableRecord *pLinetypeTableRec=new AcDbLinetypeTableRecord;
        //设置线型名称注意,命名规范
        pLinetypeTableRec->setName(L"YJV10X5");     
        //pLinetypeTableRec->setAsciiDescription(_T("YJV10X5 ____YJV10*5 ____"));
        //线型说明文字高版本建议用setComments
        pLinetypeTableRec->setComments(_T("YJV10X5 ____YJV10*5 ____"));
        //设置Dash短划线数量
        pLinetypeTableRec->setNumDashes(3);
        //设置短划线的长度,正值为实线,负值为空格,0是点
        pLinetypeTableRec->setDashLengthAt(0,1.25);
        pLinetypeTableRec->setDashLengthAt(1,-1.75);

 

        //设置Shape或Text样式Id
        pLinetypeTableRec->setShapeStyleAt(1,txtStyleId);
        //比例,文字高度