首页 > 其他 > 详细

ObjectARX创建文字

时间:2020-02-23 01:23:24      阅读:89      评论:0      收藏:0      [点我收藏+]

头文件

#pragma once
#include "StdAfx.h"
#include "StdArx.h"
class CDrawTexter
{
public:
CDrawTexter(void);
~CDrawTexter(void);
AcDbObjectId AddText(const AcGePoint3d& ptInsert, const TCHAR* text, AcDbObjectId style =
AcDbObjectId::kNull, double height = 25, double rotation = 0);//单行文字
AcDbObjectId AddMText(const AcGePoint3d& ptInsert, const TCHAR* text, AcDbObjectId style =
AcDbObjectId::kNull, double height = 25, double width = 10);//多行文字
void Draw();
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
CPP文件

#include "stdafx.h"
#include "DrawTexter.h"


CDrawTexter::CDrawTexter(void)
{
}


CDrawTexter::~CDrawTexter(void)
{
}

AcDbObjectId CDrawTexter::AddText(const AcGePoint3d& ptInsert, const TCHAR* text, AcDbObjectId style,
double height, double rotation)
{
AcDbText *pText = new AcDbText(ptInsert, text, style, height, rotation);
return AddToModelSpace(pText);
}

AcDbObjectId CDrawTexter::AddMText(const AcGePoint3d& ptInsert, const TCHAR* text, AcDbObjectId style,
double height, double width)
{
AcDbMText *pMText = new AcDbMText;
pMText->setTextStyle(style);
pMText->setContents(text);
pMText->setLocation( ptInsert);
pMText->setTextHeight(height);
pMText->setWidth(width);
pMText->setAttachment(AcDbMText::kTopMid);
return AddToModelSpace(pMText);
}

void CDrawTexter::Draw()
{
AcGePoint3d ptTemp;
ads_getpoint(asDblArray(ptTemp),_T("\n插入文字"),asDblArray(ptTemp));
AddText(ptTemp, _T("阿斯蒂芬斯蒂芬"));
ptTemp.set(ptTemp.x+300, ptTemp.y+300,ptTemp.z);
AddMText(ptTemp,_T("试试事实上事实上事实上事实上事实上事实上事实上事实上事实上事实上事实上"));
}

原文链接:https://blog.csdn.net/sky79/article/details/47401225

ObjectARX创建文字

原文:https://www.cnblogs.com/mjgw/p/12348140.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!