找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 859|回复: 4

[ARX程序]:怎样把防护林线型文件调出在半径编辑框中显示1, 半径编辑框中显示100?

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

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

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

×
在土地平整设计中, 需要布置防护林. 在图纸中, 一个圆圈表示一棵树, 一排圆圈表示一排防护林.
再用以下文件Y.LIN定义一个线型作防护林用:
*YYL1,F2 circle     0     0     0     0     0     0     0
A,0,[CIRC2,Y.shx,s=1],-100

怎样在以下C文件的半径编辑框中显示1, 半径编辑框中显示100?

// MyExam07Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "MyExam07Dlg.h"
#include "exam07.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// MyExam07Dlg dialog


MyExam07Dlg::MyExam07Dlg(CWnd* pParent /*=NULL*/)
        : CAcUiDialog(MyExam07Dlg::IDD, pParent)
{
        //{{AFX_DATA_INIT(MyExam07Dlg)
        //}}AFX_DATA_INIT
}


void MyExam07Dlg::DoDataExchange(CDataExchange* pDX)
{
        CAcUiDialog::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(MyExam07Dlg)
        DDX_Control(pDX, IDC_COMBO_REGAPPS, m_ctrlRegAppComboBox);
        //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(MyExam07Dlg, CAcUiDialog)
        //{{AFX_MSG_MAP(MyExam07Dlg)
        ON_CBN_KILLFOCUS(IDC_COMBO_REGAPPS, OnKillfocusComboRegapps)
        ON_EN_CHANGE(IDC_EDIT_XPT, OnChangeEditXpt)
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// MyExam07Dlg message handlers

BOOL MyExam07Dlg::OnInitDialog()
{
//        FILE *fp;
//        if ((fp=fopen("y.lin","r"))==0) {
//                acutPrintf("找不到文件");
//                return;
//        }

        SetDialogName("exam07:MyExam07Dlg");
        CAcUiDialog::OnInitDialog();
        DLGCTLINFO dlgSizeInfo[]= {
                { IDC_STATIC_GROUP1, ELASTICX, 20 },
                { IDC_STATIC_GROUP1, ELASTICY, 100 },
                { IDC_EDIT_XPT,ELASTICX, 20 },
                { IDC_EDIT_YPT,ELASTICX, 20 },
               
               
       
                { IDC_COMBO_REGAPPS, MOVEY, 100 },
                { IDC_COMBO_REGAPPS, ELASTICX, 20 },
       
                { IDOK,MOVEX, 100 },
                { IDCANCEL, MOVEX, 100 },
        };

        const DWORD numberofentries =
                sizeof dlgSizeInfo / sizeof DLGCTLINFO;
        SetControlProperty(dlgSizeInfo, numberofentries);

       
        SetWindowText("Forrest Linetype");
       


        DisplayRegApps();
        return TRUE;
}



void MyExam07Dlg::DisplayRegApps()
{
        AcDbRegAppTable *pRegAppTable;
        acdbHostApplicationServices()->workingDatabase()
                ->getSymbolTable(pRegAppTable, AcDb::kForRead);

        char *pName;
        AcDbRegAppTableIterator *pItr;
        if (pRegAppTable->newIterator(pItr) == Acad::eOk)
        {
                while (!pItr->done())
                {
                        AcDbRegAppTableRecord *pRecord;
                        if (pItr->getRecord(pRecord, AcDb::kForRead)
                                == Acad::eOk)
                        {
                                pRecord->getName(pName);
                                m_ctrlRegAppComboBox.InsertString(-1, pName);
                                pRecord->close();
                        }
                        pItr->step();
                }
        }
        pRegAppTable->close();
}



void MyExam07Dlg::OnKillfocusComboRegapps()
{
        CString strFromEdit;
        m_ctrlRegAppComboBox.GetWindowText(strFromEdit);
        if (m_ctrlRegAppComboBox.FindString(-1, strFromEdit) == CB_ERR)
                if (acdbRegApp(strFromEdit) == RTNORM)
                        m_ctrlRegAppComboBox.AddString(strFromEdit);
}

void MyExam07Dlg::OnOK()
{


        CAcUiDialog::OnOK();
}


void MyExam07Dlg::OnChangeEditXpt()
{
        // TODO: If this is a RICHEDIT control, the control will not
        // send this notification unless you override the CAcUiDialog::OnInitDialog()
        // function and call CRichEditCtrl().SetEventMask()
        // with the ENM_CHANGE flag ORed into the mask.
       
        // TODO: Add your control notification handler code here
       
}
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
 楼主| 发表于 2002-4-24 03:01:50 | 显示全部楼层

为什么会退出ARX时出现unhandled exception c0000005?

为什么会退出ARX时出现unhandled exception c0000005(Access violation reading 0Xcccccce8) at address 6bc418d8h)

The following is the code:

#include "stdafx.h"
#include "MyExam07Dlg.h"
#include "exam07.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


MyExam07Dlg::MyExam07Dlg(CWnd* pParent /*=NULL*/)
        : CAcUiDialog(MyExam07Dlg::IDD, pParent)
{
        //{{AFX_DATA_INIT(MyExam07Dlg)
                // NOTE: the ClassWizard will add member initialization here
        //}}AFX_DATA_INIT
}


void MyExam07Dlg::DoDataExchange(CDataExchange* pDX)
{
        CAcUiDialog::DoDataExchange(pDX);

        DDX_Control(pDX, IDC_EDIT_YPT, m_ctrlYPtEdit);
        DDX_Control(pDX, IDC_EDIT_XPT, m_ctrlXPtEdit);
       
       
       
        //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(MyExam07Dlg, CAcUiDialog)
        //{{AFX_MSG_MAP(MyExam07Dlg)
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()


BOOL MyExam07Dlg::OnInitDialog()
{

        SetDialogName("exam07:MyExam07Dlg");
        CAcUiDialog::OnInitDialog();
        DLGCTLINFO dlgSizeInfo[]= {
                { IDC_STATIC_GROUP1, ELASTICX, 20 },
                { IDC_STATIC_GROUP1, ELASTICY, 100 },
                { IDC_EDIT_XPT,ELASTICX, 20 },
                { IDC_EDIT_YPT,ELASTICX, 20 },
                { IDC_EDIT_ZPT,ELASTICX, 20 },
                { IDC_EDIT_ANGLE, ELASTICX, 20 },
                { IDC_STATIC_GROUP2, MOVEX, 20 },
                { IDC_STATIC_GROUP2, ELASTICY, 100 },
                { IDC_STATIC_GROUP2, ELASTICX, 80 },
                { IDC_LIST_BLOCKS, MOVEX, 20 },
                { IDC_LIST_BLOCKS, ELASTICY, 100 },
                { IDC_STATIC_TEXT2,MOVEX, 20 },
                { IDC_STATIC_TEXT2,MOVEY, 100 },
                { IDC_LIST_BLOCKS, ELASTICX, 80 },
                { IDC_STATIC_TEXT2,ELASTICX, 80 },
                { IDC_STATIC_GROUP3, MOVEY, 100 },
                { IDC_STATIC_GROUP3, ELASTICX, 20 },
                { IDC_COMBO_REGAPPS, MOVEY, 100 },
                { IDC_COMBO_REGAPPS, ELASTICX, 20 },
                { IDC_STATIC_TEXT3,MOVEY, 100 },
                { IDC_STATIC_TEXT3,ELASTICX, 20 },
                { IDOK,MOVEX, 100 },
                { IDCANCEL, MOVEX, 100 },
        };

        const DWORD numberofentries =
                sizeof dlgSizeInfo / sizeof DLGCTLINFO;
        SetControlProperty(dlgSizeInfo, numberofentries);

        m_ctrlXPtEdit.SetRange(-50.0, 50.0);
        m_ctrlYPtEdit.SetRange(-50.0, 50.0);
       
       
       
       
        SetWindowText("forrest Line");
       

        return TRUE;
}


void MyExam07Dlg::OnOK()
{
        CAcUiDialog::OnOK();
}
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2002-4-25 05:13:36 | 显示全部楼层

为什么编译dialog是有显示文本radius, 但是运行时却没有radius?

为什么编译dialog是有显示文本radius, 但是运行时却没有radius?
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_DIALOG1 DIALOG DISCARDABLE  0, 0, 189, 60
STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,132,7,50,14
    EDITTEXT        IDC_EDIT_XPT,53,17,52,15,ES_AUTOHSCROLL
    EDITTEXT        IDC_EDIT_YPT,53,34,52,15,ES_AUTOHSCROLL
    PUSHBUTTON      "Cancel",IDCANCEL,132,24,50,14
    GROUPBOX        "Edit ",IDC_STATIC_GROUP1,7,7,104,46
    LTEXT           "radius",IDC_STATIC,18,19,25,8
    LTEXT           "offset",IDC_STATIC,17,36,25,8
END


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
    IDD_DIALOG1, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 182
        TOPMARGIN, 7
        BOTTOMMARGIN, 53
    END
END
#endif    // APSTUDIO_INVOKED

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
#ifdef _WIN32
LANGUAGE 4, 2
#pragma code_page(936)
#endif //_WIN32
#include "res\exam07.rc2"  // non-Microsoft Visual C++ edited resources
#include "l.chs\afxres.rc"          // Standard components
#endif

/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2002-4-26 04:31:26 | 显示全部楼层

为什么下面的代码不能显示半径为1, 间距为50?

为什么下面的代码不能显示半径为1, 间距为50?
void MyExam07Dlg::DisplayPoint()
{   FILE *fp;

    if ((fp=fopen("y.lin","w"))==0) {
             printf("cannot open file \n");
             return;
     }
    acutPrintf("display. \n");

        while((m_str=getc(fp)) != EOF) {
      acutPrintf("%s,str.\n", m_str);
      if (m_str == '=')  m_strXPt=getc(fp);
      if (m_str == '-')  m_strYPt=getc(fp);   
        }

    acutPrintf("%s,radius", m_strXPt);
    acutPrintf("%s,offset", m_strYPt);

        m_ctrlXPtEdit.SetWindowText(m_strXPt);
        m_ctrlXPtEdit.Convert();
        m_ctrlYPtEdit.SetWindowText(m_strYPt);
        m_ctrlYPtEdit.Convert();
    fclose(fp);
}

y.lin如下:
*YYL1,F2 circle     0     0     0     0     0     0     0
A,0,[CIRC2,Y.shx,s=1],-50
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2002-4-29 22:49:38 | 显示全部楼层

为什么半径是5而不是1, 间距是0而不是50?

为什么半径是5而不是1, 间距是0而不是50?

Y.LIN IS AS FOLLOWED:
*YYL1,F2 circle     0     0     0     0     0     0     0
A,0,[CIRC2,Y.shx,s=1],-50



void MyExam07Dlg::DisplayPoint()
{   FILE *fp;

    if ((fp=fopen("y.lin","r"))==0) {
             printf("cannot open file \n");
             return;
     }
    acutPrintf("display. \n");
    //AfxMessageBox("m_str");

    acutPrintf("%c fir\n", getc(fp));
    acutPrintf("%c fir\n", getc(fp));

        while ((m_str=getc(fp)) != EOF) {
          //AfxMessageBox(m_str);  @ ? ?
      //acutPrintf("%c,str.\n", m_str);
      if (m_str = "=")  m_strXPt=getc(fp);
      if (m_str = "-")  m_strYPt=getc(fp);   
        }

    acutPrintf("%s radius\n", m_strXPt);
    acutPrintf("%s offset\n", m_strYPt);

        m_ctrlXPtEdit.SetWindowText(m_strXPt);
        m_ctrlXPtEdit.Convert();
        m_ctrlYPtEdit.SetWindowText(m_strYPt);
        m_ctrlYPtEdit.Convert();
    fclose(fp);
}
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-29 01:51 , Processed in 0.425178 second(s), 39 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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