乐筑天下

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

自定义对象派生自acdb3dSolid一些问题?

[复制链接]

23

主题

48

帖子

4

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
140
发表于 2011-1-26 20:19:03 | 显示全部楼层 |阅读模式
我正在编写一个新的自定义对象,它是从acdb3dSolid派生的,我有两个新的myCustom,我该如何做booleanOper()?

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

23

主题

48

帖子

4

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
140
发表于 2011-1-27 22:03:45 | 显示全部楼层
帮帮我!
回复

使用道具 举报

69

主题

875

帖子

15

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1146
发表于 2011-1-28 17:48:53 | 显示全部楼层
好的,但首先,你对arx和C++有多高的经验?你对自定义对象做了多少研究
帮助文档中有一些示例和规则/提示也涵盖了此主题。自定义对象不是一个简单的练习,需要花费大量的时间和精力来开发
但是,既然您提出了要求,基本上您需要在自定义对象中包装一个acdb3dsolid(acdb3dsolid=*pSolid;)并提供一个接口,将其公开给其他“MySolid”自定义对象
当您想对一个或多个对象执行操作时,您可以将本机实体函数包装到您自己的函数中,然后将MySolid对象传递给该函数。您可以提取本机实体并调用本机方法,然后将结果返回到MySolid物件中
这是一段相当粗糙的伪代码,仅需思考即可(已经有一段时间了)-
  1. Class Mysolid:AcDb3dSolid() // custom object inherits native acdb 3d solid
  2. {
  3.    private AcDb3dSolid * pNativeSolid; //pointer to native solid
  4.    // this next function is private as we want to keep the native solid a secret ;)
  5.    private AcDb3dSolid * GetNativeSolid ()
  6.    {
  7.        return this->pNativeSolid; // get the stored native solid
  8.    }
  9.    // a boolean subtraction operation for example:
  10.    public void MySolidSubtractionOp (MySolid * pSolidCutter, MySolid * pSolidToBeCut)
  11.    {
  12.        //ok, we need to get both native solids:
  13.        AcDb3dSolid * pSolCut = pSolidCutter->GetNativeSolid();
  14.        AcDb3dSolid * pSoltobeCut = pSolidCutter->GetNativeSolid();
  15.       // now we use the native operation using the native solids:
  16.       // note this is only guessing here for an example!
  17.       AcDb3dSolid * pResult = pSoltobeCut->booleanOperation(boolean::Subtract, pSolCut) // pass in operation type and cutting solid
  18.       // now we have a result (if all went well, remember to check the result using errorstatus etc) we can wrap it back into the solid
  19.       // since it was 'this' solid being cut, we store the pointer back in 'this' solid
  20.       this->pNativeSolid = pResult;
  21.    }
  22. }

希望这对您更清楚,您需要对所有要使用的本机solid方法执行类似的操作,当然您可以创建自己的方法以适合您的自定义对象。
干杯,
米克。
回复

使用道具 举报

23

主题

48

帖子

4

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
140
发表于 2011-1-29 01:13:48 | 显示全部楼层
非常感谢!
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-2-5 16:57 , Processed in 0.386724 second(s), 60 queries .

© 2020-2025 乐筑天下

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