几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   ObjectARX(C++) (http://www.dimcax.com/hust/forumdisplay.php?f=34)
-   -   【转帖】objectarx&dummies习题(三)—— creating a custom object (http://www.dimcax.com/hust/showthread.php?t=6308)

yang686526 2009-04-16 10:33 AM

【转帖】objectarx&dummies习题(三)—— creating a custom object
 
objectarx&dummies习题(三)—— creating a custom object
objectarx&dummies习题(三)—— creating a custom object
lab 3 - creating a custom object
hello,
our third lab will cover custom objects. you will need to create a custom object, its properties, functions and dictionary related methods.
requirements:
* class 1 to 12;
* autocad 4/5/6 or compatible vertical installed;
* visual studio .net 2 installed;
* objectarx wizard installed.
objectives:
the main idea is to create the first part of a complete custom shape application. this part consist of building the custom object which will represent the shape form with properties that allows you to completely define it.
the second step will be the custom entity which will refer to its associated shape. as several entities may use the same shape it is not a good idea to repeat the shape information inside each entity. exactly due that we will create this custom object which will store de shape information and share this information with all custom entities related to it.
it will be an "i" shape with equal top and bottom flanges and it will need to store the following information:
-web height (d) - double;
-web thickness (tw) - double;
-flange width (bf) - double;
-flange thickness (tf) - double;
-shape name (desig) - cstring;
instructions:
- you will create two projects. the first, called shapesui (which will be the objectarx module) and the second called shapesobj (which will be the objectdbx module)
using objectarx wizard;
- enable using mfc option in both projects;
- after created both projects, open the autodesk view toolbar , select the shapesobj project and create the custom object called shapeobject;
- override filling functions (dwgoutfields / dwginfields);
- implement all necessary properties to this object and provide is persistence through dwg filling functions;
- create two functions. one to create the object and stored it inside nod and other to list all existing objects. use your custom dictionary as shapeapp;
- use "*" as the key name of each shape inside shapeapp dictionary;
- create a research function which will receive the shape information and will lookup an existing shape that matches with the information. if it is found, return it's objectid instead of create a duplicated shape. if it is not found, create a new shape and return its brand new objectid;
- don't forget to create a == operator for your class to make easy to compare shapes when researching the dictionary;
tips:
- use the class 12 code fragment to help you with this project;
- add properties using arxwizard because it will create the access methods and will put the filling line at dwginfields() and dwgoutfields() functions;
- be careful about code flow inside dictionary manipulation functions;
- double check your open / close scopes;
- test save and open the dwg to assert that the custom objects are successfully saved and loaded;
- use arxdbg to verify if your custom objects are placed into the right place;
- use the objectarx documentation when necessary;
support:
if you have any questions please post your issue on this article to share with others.
expected time:
- i will give you 7 days to accomplish this lab;
- after this period, i will post my suggested solution for this.


所有的时间均为北京时间。 现在的时间是 01:19 PM.