乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 100|回复: 4

请教关于AcDb2dPolyline中定点添加的问题?

[复制链接]

6

主题

12

帖子

1

银币

初来乍到

Rank: 1

铜币
36
发表于 2002-9-25 11:00:00 | 显示全部楼层 |阅读模式
我现在有以下程序:
AcDb2dPolyline *pLine;
AcGePoint3d startPt;
AcGePoint3d endPt;
AcGePoint3dArray vertices;
   vertices.append(startPt);
        vertices.append(endPt);
pLine->appendVertex(vertices);
以前这段程序好像可以现在却不行了,请问用appendVertex添加起点和终点不行吗?
回复

使用道具 举报

6

主题

12

帖子

1

银币

初来乍到

Rank: 1

铜币
36
发表于 2002-10-1 15:23:00 | 显示全部楼层
error C2664: 'enum Acad::ErrorStatus __thiscall AcDb2dPolyline::appendVertex(class AcDb2dVertex *)' : cannot convert parameter 1 from 'class AcArray >' to 'class AcDb2dVertex *'
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called。
回复

使用道具 举报

14

主题

230

帖子

5

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
286
发表于 2002-10-8 07:49:00 | 显示全部楼层

用pLine->appendVertex(); 可以添加顶点,但你的程序中参数使用不对。应该是这样:
AcGePoint3d *q = pCircle->center();
AcDb2dVertex *pVertex=new AcDb2dVertex(q);
pLine->appendVertex(pVertex);
也就是说,appendVertex()函数需要一个AcDb2dVertex类型的参数。你应该调用AcDb2dVertex类的构造函数AcDb2dVertex *pVertex=new AcDb2dVertex();来实现类型转换。
回复

使用道具 举报

6

主题

12

帖子

1

银币

初来乍到

Rank: 1

铜币
36
发表于 2002-10-8 10:20:00 | 显示全部楼层
我是在做一个pline线和圆相关联。就是移动圆,pline线的起点跟着做相关移动。
line线是可以的。但是pline线就出错。(在vc下过了,但是会使autocad出现调用错误,然后cad就关了。)
所以我以为可能是指针调用错误。就想试试不用指针。
不知道有没有别的解决办法,敬请指教!
回复

使用道具 举报

14

主题

230

帖子

5

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
286
发表于 2002-10-8 14:12:00 | 显示全部楼层
The following example creates a simple context reactor that responds to a variety of input context events:
#include
#include
#include
#include
#include
#include
// The input context reactor class.
class MyContextReactor : public AcEdInputContextReactor
{
public:
  void beginGetPoint(const AcGePoint3d* pointIn,const char* promptString, int initGetFlags,const char* pKeywords);
  void endGetPoint(Acad:romptStatus returnStatus,const AcGePoint3d& pointOut, const char*& pKeyword);
  void beginGetOrientation(const AcGePoint3d* pointIn,const char* promptString,int initGetFlags,const char* pKeywords);
  void endGetOrientation(Acad:romptStatus returnStatus,  double& angle,const char*& pKeyword);
  void beginGetCorner(const AcGePoint3d* firstCorner,const char* promptString,int initGetFlags,const char* pKeywords);
    void endGetCorner(Acad:romptStatus returnStatus,  AcGePoint3d& secondCorner,const char*& pKeyword);
    void beginSSGet(const char*  pPrompt,int initGetFlags,const char*  pKeywords,const char*  pSSControls,const Array& points,const resbuf* entMask);
    void endSSGet(Acad:romptStatus returnStatus,const AcArray& ss);
};
void MyContextReactor::beginGetPoint(const AcGePoint3d* pointIn,    const char* promptString,int initGetFlags,const char* pKeywords)
{
    acutPrintf("beginGetPoint: pointIn = %.2f,%.2f,%.2f\n",
        (*pointIn)[0], (*pointIn)[1], (*pointIn)[2]);
    if (NULL != promptString)
        acutPrintf("%s", promptString);
    acutPrintf("initGetFlags: %d\n", initGetFlags);
    if (NULL != pKeywords)
        acutPrintf("Keywords: %s\n", pKeywords);
}
void MyContextReactor::endGetPoint(Acad:romptStatus returnStatus, const AcGePoint3d& pointOut,const char*& pKeyword)
{
    acutPrintf("endGetPoint: %d\n", returnStatus);
    acutPrintf("%.2f,%.2f,%.2f\n", pointOut[0], pointOut[1],
        pointOut[2]);
    if (NULL != pKeyword)
        acutPrintf("Keyword: %s\n", pKeyword);
}
void MyContextReactor::beginGetOrientation(const AcGePoint3d* pointIn,const char* promptString, int initGetFlags,const char* pKeywords)
{
    acutPrintf("beginGetOrientation: %.2f, %.2f, %.2f\n",
        (*pointIn)[0], (*pointIn)[1], (*pointIn)[2]);
}
void MyContextReactor::endGetOrientation(Acad:romptStatus returnStatus,double& angle,const char*& pKeyword)
{
    acutPrintf("endGetOrientation: %.2f\n", angle);
}
void MyContextReactor::beginGetCorner(const AcGePoint3d* firstCorner,const char* promptString,int initGetFlags,const char* pKeywords)
{
    if (NULL != firstCorner)
    {
        acutPrintf(
            "beginGetCorner: %.2f, %.2f, %.2f\n",
            (*firstCorner)[0],
            (*firstCorner)[1],
            (*firstCorner)[2]);
    }
}
void MyContextReactor::endGetCorner(Acad:romptStatus returnStatus,AcGePoint3d& secondCorner,const char*& pKeyword)
{
    acutPrintf("endGetCorner\n");
}
void MyContextReactor::beginSSGet(const char*  pPrompt,  int initGetFlags,const char*  pKeywords,const char*  pSSControls,   const AcArray& points,const resbuf* entMask)
{
    acutPrintf("beginSSGet:%s\n", NULL != pPrompt ? pPrompt : "");
    for (int i = 0; i & ss)
{
    acutPrintf("endSSGet\n");
    for (int i = 0; i \n", i, ss[i].asOldId());
}
// My context reactor object
MyContextReactor my_icr;
extern "C" __declspec(dllexport) AcRx::AppRetCode
acrxEntryPoint(AcRx::AppMsgCode msg, void *p)
{
    switch (msg)
    {
    case AcRx::kInitAppMsg:
        acrxUnlockApplication(p);
        acrxRegisterAppMDIAware(p);
        break;
    case AcRx::kLoadDwgMsg:
        // Attach a context reactor to the current document.
        //
        curDoc()->inputPointManager()->
            addInputContextReactor(&my_icr);
        break;
    case AcRx::kUnloadAppMsg:
        // Warning! This sample attaches a context reactor,
        // but it never detaches it. A real-life application
        // will need to monitor to which document it attached
        // the reactor, and will need to detach it.
        //
        break;
    }
    return AcRx::kRetOK;
}
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-2-4 06:36 , Processed in 0.224011 second(s), 62 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表