找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 406|回复: 4

[ARX程序]:急求问!调用自定义类画一个图形,编译时出错

[复制链接]
发表于 2004-5-14 16:41:14 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
急求问!调用自定义类画一个图形,编译时出错,fatal error C1010: unexpected end of file while looking for precompiled header directive
      出错文件是RectWindow.cpp
This error can be caused by specifying an incorrect file as a header file, or by specifying an include file with the /Yu (Use Precompiled Header) command line option that is not listed in the source file as an include file.

这是MSDN上的提示,我不太明白,望大虾指点!!!!

类头文件和执行文件如下:
//RectWindow.h

#ifndef RECTWINDOW_H
#define RECTWINDOW_H

#include <gept2dar.h>

class RectWindow
{
        public:
               
                RectWindow();        // Constructor
                ~RectWindow();        // Destructor

                void drawWindow(AcDbBlockTableRecord* pBlkTableRecord);
                               
                void setWindowRows(int rowQty);
                void setWindowCols(int colQty);
                virtual void setWindowHeight(double windHeight);
                void setWindowLength(double windLength);
                void setWindowStartPoint(AcGePoint2d lowLeftPoint);

        protected:

                double getWindowLength() const;
                double getWindowHeight() const;
                AcGePoint2d getWindowStartPoint() const;
                double getIntrFrameThk() const;
                double getRectFrameThk() const;
                Adesk::Boolean drawIntBar(AcDbBlockTableRecord* pBlkTableRecord,
                                                                        AcGePoint2dArray intBarAr);

        private:

                Adesk::Boolean drawRectFrame(AcDbBlockTableRecord* pBlkTableRecord,
                                                                        AcGePoint2dArray &inrRectFrame);


                int getWindowRows() const;
                int getWindowCols() const;


                int rows;
                int cols;
                double rectFrameLen;
                double rectFrameHt;
                double rectFrameThk;
                double intrFrameThk;
                AcGePoint2d lowLeftPt;
};
#endif
////////执行文件//////////////  RectWindow.cpp
#include <acdb.h>                // acdb definitions
#include <adslib.h>                // ads defs
#include <dbsymtb.h>
#include <adeskabb.h>
#include <dbpl.h>                // AcDbPolyline

#include <gepnt2d.h>
#include <gept2dar.h>

#include "RectWindow.h"

RectWindow::RectWindow()
{
        rectFrameThk = 2.00;
        intrFrameThk = 1.00;

        rows = 1;
        cols = 1;
        rectFrameLen = 0.0;
        rectFrameHt         = 0.0;

        lowLeftPt.set(0.0, 0.00);
}

RectWindow::~RectWindow()
{
}
void RectWindow::drawWindow(AcDbBlockTableRecord* pBlkTableRecord)
{
        AcGePoint2dArray inrRectFrame;
        AcGePoint2dArray inrTopAr, inrBtmAr, inrLeftAr, inrRtAr;
        AcGePoint2dArray barAr;
        AcGeLineSeg2d inrTop, inrBtm, inrLeft, inrRt;
        AcGeVector2d vec;

        AcGePoint2d sp, ep, ll, lr, ul, ur;

        double frameThk;

        int arSize;
        int rowPos, colPos;
       
        int rows, cols;
       
        if(!drawRectFrame(pBlkTableRecord, inrRectFrame))
        {
                return;
        }

        rows = getWindowRows();
        cols = getWindowCols();

        if(rows == 1 && cols == 1)
        {
                return;
        }
        arSize = inrRectFrame.length();
        if(arSize != 4)
        {
                acutPrintf("\nInvalid internal rect frame array. ");
                return;
        }
        frameThk = getIntrFrameThk();

        barAr.setLogicalLength(0);

        inrTop.set(inrRectFrame.at(3), inrRectFrame.at(2));
        inrBtm.set(inrRectFrame.at(0), inrRectFrame.at(1));
        inrTop.getSamplePoints(cols + 1, inrTopAr);
        inrBtm.getSamplePoints(cols + 1, inrBtmAr);
        inrRt.getSamplePoints(rows + 1, inrRtAr);
        if(cols == 1 && rows > 1)
        {
                // Draw horizontal bars only
                for (rowPos = 1; rowPos < rows; rowPos++)
                {
                        // Get the start point and the end point from the array
                        sp = inrLeftAr.at(rowPos);
                        ep = inrRtAr.at(rowPos);
                       
                        // from sp and ep calculate ll, lr ,ul, ur
                        vec.set(0, (frameThk / 2));
                        ll = sp - vec;
                        lr = ep - vec;
                        ul = sp + vec;
                        ur = ep + vec;
                        barAr.append(ll);
                        barAr.append(lr);
                        barAr.append(ur);
                        barAr.append(ul);

                        if(!drawIntBar(pBlkTableRecord, barAr))
                        {
                                acutPrintf("\nError drawing internal horizontal frame member. ");
                        }
                        barAr.setLogicalLength(0);
                }// for
        }// if

        if(rows == 1 && cols > 1)
        {
                // Draw vertical bars only
                for (colPos = 1; colPos < cols; colPos++)
                {
                        // Get the start point and the end point from the array
                        sp = inrBtmAr.at(colPos);
                        ep = inrTopAr.at(colPos);
                       
                        // from sp and ep calculate ll, lr ,ul, ur
                        vec.set((frameThk / 2), 0);
                        ll = sp - vec;
                        lr = sp + vec;
                        ul = ep - vec;
                        ur = ep + vec;

                        barAr.append(ll);
                        barAr.append(lr);
                        barAr.append(ur);
                        barAr.append(ul);

                        if(!drawIntBar(pBlkTableRecord, barAr))
                        {
                                acutPrintf("\nError drawing internal horizontal frame member. ");
                        }

                        barAr.setLogicalLength(0);
                }// for
        }// if

        if(rows > 1 && cols > 1)
        {
                for(rowPos = 1; rowPos < rows; rowPos++)
                {
                        for(colPos = 1; colPos <= cols; colPos++)
                        {
                                sp.x = inrBtmAr.at(colPos - 1).x;
                                sp.y = inrLeftAr.at(rowPos).y;
                                ep.x = inrBtmAr.at(colPos).x;
                                ep.y = inrLeftAr.at(rowPos).y;

                                // Calculate ll, lr, ul, ur
                                if(colPos == 1)
                                {
                                        vec.set(0, (frameThk / 2));
                                        ll = sp - vec;
                                        ul = sp + vec;
                                        vec.set( -(frameThk / 2), -(frameThk / 2));
                                        lr = ep + vec;
                                        vec.set( -(frameThk / 2), (frameThk / 2));
                                        ur = ep + vec;
                                        // Add the point to the barAr array
                                        barAr.append(ll);
                                        barAr.append(lr);
                                        barAr.append(ep);
                                        barAr.append(ur);
                                        barAr.append(ul);

                                        if(!drawIntBar(pBlkTableRecord, barAr))
                                        {
                                                acutPrintf("\nError drawing internal horizontal frame member. ");
                                        }

                                        barAr.setLogicalLength(0);                                       
                                }
                                else if(colPos == cols)
                                {
                                        vec.set((frameThk / 2), (frameThk / 2));
                                        ul = sp + vec;
                                        vec.set((frameThk / 2), -(frameThk /2));
                                        ll = sp + vec;
                                        vec.set(0, (frameThk / 2));
                                        lr = ep - vec;
                                        ur = ep + vec;

                                        barAr.append(sp);
                                        barAr.append(ll);
                                        barAr.append(lr);
                                        barAr.append(ur);
                                        barAr.append(ul);

                                        if(!drawIntBar(pBlkTableRecord, barAr))
                                        {
                                                acutPrintf("\nError drawing internal horizontal frame member. ");
                                        }

                                        barAr.setLogicalLength(0);                                       
                                }
                                else
                                {
                                        vec.set((frameThk / 2), (frameThk / 2));
                                        ul = sp + vec;
                                        vec.set((frameThk / 2), -(frameThk /2));
                                        ll = sp + vec;
                                        vec.set( -(frameThk / 2), (frameThk / 2));
                                        ur = ep + vec;
                                        vec.set( -(frameThk / 2), -(frameThk / 2));
                                        lr = ep + vec;

                                        barAr.append(sp);
                                        barAr.append(ll);
                                        barAr.append(lr);
                                        barAr.append(ep);
                                        barAr.append(ur);
                                        barAr.append(ul);

                                        if(!drawIntBar(pBlkTableRecord, barAr))
                                        {
                                                acutPrintf("\nError drawing internal horizontal frame member. ");
                                        }

                                        barAr.setLogicalLength(0);
                                }
                        }// for

                        colPos = 1;

                }// for

                for(colPos = 1; colPos < cols; colPos++)
                {
                        for(rowPos = 1; rowPos <= rows; rowPos++)
                        {
                                sp.x = inrBtmAr.at(colPos).x;
                                sp.y = inrLeftAr.at(rowPos - 1).y;
                                ep.x = inrBtmAr.at(colPos).x;
                                ep.y = inrLeftAr.at(rowPos).y;

                                if(rowPos == 1)
                                {
                                        vec.set((frameThk / 2), 0);
                                        ll = sp - vec;
                                        lr = sp + vec;
                                        vec.set( -(frameThk / 2), -(frameThk / 2));
                                        ul = ep + vec;
                                        vec.set((frameThk / 2), -(frameThk / 2));
                                        ur = ep + vec;
                                        // Add the point to the barAr array
                                        barAr.append(ll);
                                        barAr.append(lr);
                                        barAr.append(ur);
                                        barAr.append(ep);
                                        barAr.append(ul);

                                        if(!drawIntBar(pBlkTableRecord, barAr))
                                        {
                                                acutPrintf("\nError drawing internal horizontal frame member. ");
                                        }

                                        barAr.setLogicalLength(0);                                       

                                }
                                else if(rowPos == rows)
                                {
                                        vec.set((frameThk / 2), 0);
                                        ul = ep - vec;
                                        ur = ep + vec;
                                        vec.set ( -(frameThk / 2), (frameThk / 2));
                                        ll = sp + vec;
                                        vec.set ( (frameThk / 2), (frameThk / 2));
                                        lr = sp + vec;
                                        // Add the point to the barAr array
                                        barAr.append(sp);
                                        barAr.append(lr);
                                        barAr.append(ur);
                                        barAr.append(ul);
                                        barAr.append(ll);

                                        if(!drawIntBar(pBlkTableRecord, barAr))
                                        {
                                                acutPrintf("\nError drawing internal horizontal frame member. ");
                                        }

                                        barAr.setLogicalLength(0);
                                }
                                else
                                {
                                        vec.set((frameThk / 2), (frameThk /2));
                                        lr = sp + vec;
                                        ul = ep - vec;
                                        vec.set ( -(frameThk / 2), (frameThk / 2));
                                        ll = sp + vec;
                                        ur = ep - vec;

                                        // Add the point to the barAr array
                                        barAr.append(sp);
                                        barAr.append(lr);
                                        barAr.append(ur);
                                        barAr.append(ep);
                                        barAr.append(ul);
                                        barAr.append(ll);

                                        if(!drawIntBar(pBlkTableRecord, barAr))
                                        {
                                                acutPrintf("\nError drawing internal horizontal frame member. ");
                                        }

                                        barAr.setLogicalLength(0);
                                }

                        }// for

                        rowPos = 1;

                }// for
        }// if
}


// Get and Set functions

int RectWindow::getWindowRows() const
{
        return rows;
}

int RectWindow::getWindowCols() const
{
        return cols;
}

double RectWindow::getWindowHeight() const
{
        return rectFrameHt;
}

double RectWindow::getWindowLength() const
{
        return rectFrameLen;
}

AcGePoint2d RectWindow::getWindowStartPoint() const
{
        return lowLeftPt;
}

double RectWindow::getRectFrameThk() const
{
        return rectFrameThk;
}

double RectWindow::getIntrFrameThk() const
{
        return intrFrameThk;
}

void RectWindow::setWindowRows(int rowQty)
{
        rows = rowQty;
}

void RectWindow::setWindowCols(int colQty)
{
        cols = colQty;
}

void RectWindow::setWindowHeight(double windHeight)
{
        rectFrameHt = windHeight;
}

void RectWindow::setWindowLength(double windLength)
{
        rectFrameLen = windLength;
}


void RectWindow::setWindowStartPoint(AcGePoint2d lowLeftPoint)
{
        lowLeftPt = lowLeftPoint;
}

Adesk::Boolean RectWindow::drawRectFrame(AcDbBlockTableRecord* pBlkTableRecord,
                          AcGePoint2dArray intBarAr)
{
        AcDbPolyline* pBar;
        AcGePoint2d vrtxPt;
        AcDbObjectId plineId;
        Acad::ErrorStatus es;

        pBar = new AcDbPolyline(intBarAr.length());

        for(int count = 0; count < intBarAr.length(); count++)
        {
                vrtxPt = intBarAr.at(count);
                pBar->addVertexAt(count, vrtxPt);
        }

        pBar->setClosed(Adesk::kTrue);

        es = pBlkTableRecord->appendAcDbEntity(plineId, pBar);
        if(es != Acad::eOk)
        {
                acutPrintf("\nError in drawing frame member. ");
                if(pBar != NULL)
                {
                        delete pBar;
                }

                return Adesk::kFalse;
        }

        pBar->close();
       
        return Adesk::kTrue;
}
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2004-5-15 10:56:07 | 显示全部楼层
没包含正确的头文件所导致的问题,在.cpp中加入#include "stdafx.h"即可了
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2004-5-16 02:07:03 | 显示全部楼层
谢谢指点,问题已经解决。导入文件时弄错了
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2004-5-18 14:01:53 | 显示全部楼层
frankzht ,像您请教一下,你自定义类画一个图形,是否可以画出不同与CAD给出的line spline arc等基本图形单元?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2005-8-16 02:48:59 | 显示全部楼层
那么又如何去调用自定义类呢
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-22 20:30 , Processed in 0.383578 second(s), 39 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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