好的,但首先,你对arx和C++有多高的经验?你对自定义对象做了多少研究
帮助文档中有一些示例和规则/提示也涵盖了此主题。自定义对象不是一个简单的练习,需要花费大量的时间和精力来开发
但是,既然您提出了要求,基本上您需要在自定义对象中包装一个acdb3dsolid(acdb3dsolid=*pSolid;)并提供一个接口,将其公开给其他“MySolid”自定义对象
当您想对一个或多个对象执行操作时,您可以将本机实体函数包装到您自己的函数中,然后将MySolid对象传递给该函数。您可以提取本机实体并调用本机方法,然后将结果返回到MySolid物件中
这是一段相当粗糙的伪代码,仅需思考即可(已经有一段时间了)-
-
- Class Mysolid:AcDb3dSolid() // custom object inherits native acdb 3d solid
- {
- private AcDb3dSolid * pNativeSolid; //pointer to native solid
- // this next function is private as we want to keep the native solid a secret ;)
- private AcDb3dSolid * GetNativeSolid ()
- {
- return this->pNativeSolid; // get the stored native solid
- }
- // a boolean subtraction operation for example:
- public void MySolidSubtractionOp (MySolid * pSolidCutter, MySolid * pSolidToBeCut)
- {
- //ok, we need to get both native solids:
- AcDb3dSolid * pSolCut = pSolidCutter->GetNativeSolid();
- AcDb3dSolid * pSoltobeCut = pSolidCutter->GetNativeSolid();
- // now we use the native operation using the native solids:
- // note this is only guessing here for an example!
- AcDb3dSolid * pResult = pSoltobeCut->booleanOperation(boolean::Subtract, pSolCut) // pass in operation type and cutting solid
- // 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
- // since it was 'this' solid being cut, we store the pointer back in 'this' solid
- this->pNativeSolid = pResult;
- }
- }
希望这对您更清楚,您需要对所有要使用的本机solid方法执行类似的操作,当然您可以创建自己的方法以适合您的自定义对象。
干杯,
米克。
|