明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2580|回复: 7

程序换到其他人的机器上画出的图全乱了

[复制链接]
发表于 2007-4-25 11:09:00 | 显示全部楼层 |阅读模式

请教(急):vs2003+objectARX开发的"三通"绘制程序,在我的机器上运行正常,换到其他人的机器上画出的图全乱了???

我的机器和其他机器均安装的AutoCAD2004中文版

发表于 2007-4-25 14:02:00 | 显示全部楼层

您给的是 Release 版还是 Debug 版?
有否引用到需向系统注册的Dll或ocx元件?

 楼主| 发表于 2007-4-26 09:09:00 | 显示全部楼层

禀告大侠,Relaese版和Debug版都试了,问题一样

禀告大侠,Relaese版和Debug版都试了,问题一样。

没用过什么高级引用

源程序如下:

void draw_st()   
{
  ads_hdlg  hdlg;    //对话框的handle
  int  dcl_id,       //对话框标识字
       dlg_status;   //对话框的状态

  struct resbuf rb;  //供存取AutoCAD系统变量之用
  short sht1,sht2;      //对话框中幻灯片的尺寸
  ads_point pt,pt1[22],pt2[35],pt3[23],pt_temp1,pt_temp2;
  ads_real flyg,flk,zxxcg;//法兰缘高,法兰宽,中心线超高
  ads_name ent,ss,ent1,ent2,ent3;


  if(ads_load_dialog("st.dcl", &dcl_id)!=RTNORM) {  
                                 //将对话框文件set_env.dcl调入内存
    acedAlert("装入st.dcl文件出错.");
    return;
  }
  if(ads_new_dialog("draw_st",dcl_id,(CLIENTFUNC)0,&hdlg)!=RTNORM) {
                                                //显示对话框,图10-1
    acedAlert("显示draw_st对话框时出错.");
    ads_unload_dialog(dcl_id);
    return;
  }

  ads_dimensions_tile(hdlg,"image_st",&sht1,&sht2);    //显示幻灯片
  ads_start_image(hdlg,"image_st");
  ads_slide_image(0,0,sht1,sht2,"stimage"); //幻灯片名为stimage
  ads_end_image();

  ads_set_tile(hdlg,"Dia", "300");

  ads_action_tile(hdlg, "accept", (CLIENTFUNC)xd_draw_st);  

//由对话框返回直径Diameter和绘制类型draw_style
   ads_start_dialog(hdlg, &dlg_status);   //与对话框进行交互


  if(acedGetPoint(NULL,"\nPick a point:",pt)==RTNORM)
  {
 /*初始化工作环境*/

 layer_do("M","FAT");             //创建线层
 layer_do("M","THIN");
 layer_do("M","CEN");
 layer_edit("C","WHITE","FAT");         //设定颜色
 layer_edit("C","WHITE","THIN");
 layer_edit("C","GREEN","CEN");
 layer_edit("L","CONTINUOUS","FAT");      //设定线型
 layer_edit("L","CONTINUOUS","THIN");
 layer_edit("L","CENTER","CEN");        
 layer_edit("LW","0.3","FAT");                              //设置线宽
 acedCommand(RTSTR,"LTSCALE",RTREAL,10.0,0);

  }
  else
  {
 acedAlert("输入插入点错误.");
  }


  if(Diameter>=200)
  {
   flyg=100;
      zxxcg=150;
  }
  else
  {
   flyg=60;
   zxxcg=90;
  }
  flk=30;

  if(draw_style[0]=='1')
  {
     //计算主视图中各点坐标
  Spoint(pt1[0],pt[X],pt[Y],pt[Z]);
  Spoint(pt1[1],pt1[0][X]-flk,pt1[0][Y]+Diameter/2+flyg,pt1[0][Z]);
  Spoint(pt1[2],pt1[1][X]+flk,pt1[1][Y],pt1[1][Z]);
  Spoint(pt1[3],pt1[2][X]+flk,pt1[2][Y],pt1[2][Z]);
  Spoint(pt1[4],pt1[3][X]-2*flk,pt1[3][Y]-Diameter-2*flyg,pt1[3][Z]);
  Spoint(pt1[5],pt1[4][X]+flk,pt1[4][Y],pt1[4][Z]);
  Spoint(pt1[6],pt1[5][X]+flk,pt1[5][Y],pt1[5][Z]);
  Spoint(pt1[7],pt1[6][X],pt1[6][Y]+Diameter+flyg,pt1[6][Z]);
  Spoint(pt1[8],pt1[7][X],pt1[7][Y]-Diameter,pt1[7][Z]);
  Spoint(pt1[9],pt1[8][X]+3*Diameter/2-flk,pt1[8][Y]+Diameter+zxxcg,pt1[8][Z]);
  Spoint(pt1[10],pt1[9][X],pt1[9][Y]-zxxcg,pt1[9][Z]);
  Spoint(pt1[11],pt1[10][X],pt1[10][Y]-Diameter/2,pt1[10][Z]);
  Spoint(pt1[12],pt1[11][X]-Diameter/2,pt1[11][Y]-Diameter/2,pt1[11][Z]);
  Spoint(pt1[13],pt1[12][X]+Diameter/2,pt1[12][Y],pt1[12][Z]);
  Spoint(pt1[14],pt1[13][X]-Diameter/2,pt1[13][Y]-3*Diameter/2+flk,pt1[13][Z]);
  Spoint(pt1[15],pt1[14][X]+Diameter/2,pt1[14][Y],pt1[14][Z]);
  Spoint(pt1[16],pt1[15][X]-Diameter/2-flyg,pt1[15][Y],pt1[15][Z]);
  Spoint(pt1[17],pt1[16][X],pt1[16][Y]-flk,pt1[16][Z]);
  Spoint(pt1[18],pt1[17][X],pt1[17][Y]-flk,pt1[17][Z]);
  Spoint(pt1[19],pt1[18][X]+Diameter/2+flyg,pt1[18][Y]+2*flk,pt1[18][Z]);
  Spoint(pt1[20],pt1[19][X],pt1[19][Y]-flk,pt1[19][Z]);
  Spoint(pt1[21],pt1[20][X],pt1[20][Y]-flk,pt1[20][Z]);

   //绘制中心线
  layer_do("S","CEN");
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[9],RT3DPOINT,pt1[21],RTSTR,"",0);
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[0],RT3DPOINT,pt1[11],RTSTR,"",0);
  acdbEntLast(ent);
  acedSSAdd(ent,NULL,ss);
  //绘制细实线
  layer_do("S","THIN");
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[1],RT3DPOINT,pt1[4],RTSTR,"",0);
  acdbEntLast(ent);
  acedSSAdd(ent,ss,ss);
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[2],RT3DPOINT,pt1[5],RTSTR,"",0);
  acdbEntLast(ent);
  acedSSAdd(ent,ss,ss);
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[3],RT3DPOINT,pt1[6],RTSTR,"",0);
  acdbEntLast(ent);
  acedSSAdd(ent,ss,ss);
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[1],RT3DPOINT,pt1[3],RTSTR,"",0);
  acdbEntLast(ent);
  acedSSAdd(ent,ss,ss);
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[4],RT3DPOINT,pt1[6],RTSTR,"",0);
  acdbEntLast(ent);
  acedSSAdd(ent,ss,ss);
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[16],RT3DPOINT,pt1[19],RTSTR,"",0);
  acdbEntLast(ent);
  acedSSAdd(ent,ss,ss);
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[17],RT3DPOINT,pt1[20],RTSTR,"",0);
   acdbEntLast(ent);
  acedSSAdd(ent,ss,ss);
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[18],RT3DPOINT,pt1[21],RTSTR,"",0);
   acdbEntLast(ent);
  acedSSAdd(ent,ss,ss);
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[16],RT3DPOINT,pt1[18],RTSTR,"",0);
  acdbEntLast(ent);
  acedSSAdd(ent,ss,ss);
  //绘制粗实线
  layer_do("S","FAT");
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[7],RT3DPOINT,pt1[10],RTSTR,"",0);
  acdbEntLast(ent);
  acedSSAdd(ent,ss,ss);
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[8],RT3DPOINT,pt1[12],RTSTR,"",0);
  acdbEntLast(ent);
  acedSSAdd(ent,ss,ss);
  acedCommand(RTSTR,"LINE",RT3DPOINT,pt1[12],RT3DPOINT,pt1[14],RTSTR,"",0);
  acdbEntLast(ent);
  acedSSAdd(ent,ss,ss);
  acedCommand(RTSTR,"ARC",RTSTR,"C",RT3DPOINT,pt1[13],RT3DPOINT,pt1[11],RT3DPOINT,pt1[12],0);
  acdbEntLast(ent);
  acedSSAdd(ent,ss,ss);

  //拷贝有半部分
  acedCommand(RTSTR,"MIRROR",RTPICKS,ss,RTSTR,"",RT3DPOINT,pt1[9],RT3DPOINT,pt1[21],RTSTR,"N",0);

  }

  else if(draw_style[0]=='2')
  {

...
   }
  else
  {

...
   }


  ads_unload_dialog(dcl_id);    //清理内存

  acedGetVar("DIASTAT",&rb);   
  if(rb.resval.rint==0) {
    acedRetVoid();    //直接返回AutoLISP,不回显nil
    return;      //CANCEL结束对话框,返回
  }

 楼主| 发表于 2007-4-26 09:18:00 | 显示全部楼层

正常的图形和变形后图形

我把正常的图形和变形后图形以图片形式上传,大侠帮忙看看

 楼主| 发表于 2007-4-26 16:19:00 | 显示全部楼层
各位看官倒是给个意见呀
 楼主| 发表于 2007-4-27 11:03:00 | 显示全部楼层

又试了一下,简直要疯了.

加载奔特力海思德的WaterCAD后 即发生变形,我该怎么办?这该死的程序倒底修改了什么设置?

加载奔特力海思德的WaterCAD后,作程序画一横线,正常。画一竖线也正常。横线竖线一起画就变形了。

发表于 2007-4-29 09:22:00 | 显示全部楼层

你程序中使用了命令,你肯定是把对象捕捉开启了,关闭即可!!!!

 楼主| 发表于 2007-4-29 10:14:00 | 显示全部楼层

问题已解决,果然是对象捕捉设置的问题。多谢大侠

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

本版积分规则

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

GMT+8, 2024-11-25 20:28 , Processed in 0.163752 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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