下载地址: http://www.mxdraw.com/ndetail_103.html 1. 增加COM接口,把常用的建模函数封闭成 com对象 2. 编写c#调用例子,比如创建一个衣柜,窗户等 比如,创建衣框代码如下: [c#] view plain copy
- axMxDrawX3d1.ShowTexturize = true;
- axMxDrawX3d1.Light = true;
- MxDraw3dMakeShape make = new MxDraw3dMakeShape();
- //第一块
- MxDraw3dShape shap = make.DoBox(0,0,0,800, 300, 15);
- MxDraw3dShapeTransformation s = new MxDraw3dShapeTransformation();
- MxDraw3dPoint pt = new MxDraw3dPoint();
- s.scale(pt, 1.0);
- MxDraw3dShapeTransformation m = new MxDraw3dShapeTransformation();
- MxDraw3dVector vec = new MxDraw3dVector();
- vec.x = -400;
- m.Move(vec);
- m.multiply(s);
- shap.TransformShape(m);
-
- MxDraw3dTexturedShape ts = make.CreateTexturedShape(shap);
- ts.SetTextureFileName("K:\\MxDraw3D6.0\\Bin\\vc100d\\Test\\wood01.bmp");
- ts.SetTextureMap(true);
- ts.SetTextureScale(true, 1, 1);
- ts.SetTextureRepeat(true, 1, 1);
- ts.SetTextureOrigin(true, 0, 0);
- ts.SetDisplayMode(3);
- axMxDrawX3d1.DrawEntity(ts);
-
- .......
-
- //第七块
-
- MxDraw3dShape shape7 = make.DoBox(0, 0, 0, 1000, 290, 15);
- MxDraw3dShapeTransformation r7 = new MxDraw3dShapeTransformation();
- MxDraw3dPoint ptRot7 = new MxDraw3dPoint();
- ptRot7.x = 1000;
- ptRot7.y = 300;
- ptRot7.z = 0;
- MxDraw3dVector pvRot7 = new MxDraw3dVector();
- pvRot7.x = 0;
- pvRot7.y = 1;
- pvRot7.z = 0;
- r7.Rotation(ptRot7, pvRot7, 90 * 3.14159265 / 180.0);
- MxDraw3dShapeTransformation s7 = new MxDraw3dShapeTransformation();
- MxDraw3dPoint ptMove7 = new MxDraw3dPoint();
- ptMove7.x = 0;
- ptMove7.y = 0;
- ptMove7.z = 0;
- s7.scale(ptMove1, 1.0);
- MxDraw3dVector pvMove7 = new MxDraw3dVector();
- pvMove7.x = -1000;
- pvMove7.y = 0;
- pvMove7.z = 0;
- MxDraw3dShapeTransformation m7 = new MxDraw3dShapeTransformation();
- m7.Move(pvMove7);
- m7.multiply(r7);
- m7.multiply(s7);
-
- shape7.TransformShape(m7);
- MxDraw3dTexturedShape ts7 = make.CreateTexturedShape(shape7);
- ts7.SetTextureFileName("K:\\MxDraw3D6.0\\Bin\\vc100d\\Test\\wood01.bmp");
- ts7.SetTextureMap(true);
- ts7.SetTextureScale(true, 1, 1);
- ts7.SetTextureRepeat(true, 1, 1);
- ts7.SetTextureOrigin(true, 0, 0);
- ts7.SetDisplayMode(3);
- axMxDrawX3d1.DrawEntity(ts7);
- axMxDrawX3d1.ZoomAll();
3. 控件运行效果抓图:
|