明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1792|回复: 3

[求助]请帮帮忙

[复制链接]
发表于 2006-12-29 16:20:00 | 显示全部楼层 |阅读模式

void onlable()
{
   float rads[3];
   int rest[3],integer[3],length[3];
   for(int k=0;k<3;k++)
   {
    // Return the angle in the XY plane of the current UCS, in radians.
    rads[k]=acutAngle(pt[k], pt[k+1]);
    // Return distance in 3D space.
    length[k]=acutDistance(pt[k], pt[k+1]);
    rest[k]=length[k]%100;//求余数
    integer[k]=length[k]/100;//求每一段整100的个数
   }
    ads_point  startpt[5000],endpt[5000];
      for(int r=0;r<3;r++)
    for(int j=0;j<3;j++)
    { 
         acutPolar(pt[r], rads[r], 100*j, startpt[j]);
   acutPolar(startpt[j],rads[r]+3.1415926/2,50,endpt[j]); 
   AcDbLine*pLine=new AcDbLine(AcGePoint3d(startpt[j][0],startpt[j][1],0),
                 AcGePoint3d(endpt[j][0],endpt[j][1],0));
    } 
    pLine->setColorIndex(1);//红色
     AcDbBlockTable *pBlockTable;
     acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable,AcDb::kForRead);
     AcDbBlockTableRecord *pBlockTableRecord;
     pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite);
     pBlockTable->close();
     AcDbObjectId lineId;
     pBlockTableRecord->appendAcDbEntity(lineId,pLine);
     pBlockTableRecord->close();
     pLine->close();
}

//ads_point pt[4] 为全局变量

E:\my doc\ARX\forth\FirstCommands.cpp(265) : error C2065: 'pLine' : undeclared identifier
E:\my doc\ARX\forth\FirstCommands.cpp(265) : error C2227: left of '->setColorIndex' must point to class/struct/union
E:\my doc\ARX\forth\FirstCommands.cpp(274) : error C2227: left of '->close' must point to class/struct/union
Error executing cl.exe.

First.arx - 3 error(s), 0 warning(s)

请各位高手帮帮忙,是点没转化好,还是acutPolar函数返回的值没有呢?

发表于 2007-1-4 11:35:00 | 显示全部楼层

好好学习下C++, 括号放错位置了:

    for(int j=0;j<3;j++)
    { 
         acutPolar(pt[r], rads[r], 100*j, startpt[j]);
   acutPolar(startpt[j],rads[r]+3.1415926/2,50,endpt[j]); 
   AcDbLine*pLine=new AcDbLine(AcGePoint3d(startpt[j][0],startpt[j][1],0),
                 AcGePoint3d(endpt[j][0],endpt[j][1],0));
  //  }错误地方
    pLine->setColorIndex(1);//红色
     AcDbBlockTable *pBlockTable;
     acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable,AcDb::kForRead);
     AcDbBlockTableRecord *pBlockTableRecord;
     pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite);
     pBlockTable->close();
     AcDbObjectId lineId;
     pBlockTableRecord->appendAcDbEntity(lineId,pLine);
     pBlockTableRecord->close();
     pLine->close();

    }//正确地方

 楼主| 发表于 2007-1-4 13:47:00 | 显示全部楼层

非常感谢老牛~~

一直困扰了我很久啊~ 我还以为里面的函数用错了

发表于 2007-1-7 20:19:00 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 22:41 , Processed in 0.147318 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表