AcDbHelix Demo
时间:2021-07-01 10:21:17
帮助过:2人阅读
AcDbObjectPointer<AcDbHelix>
aHelix;
2 aHelix.create();
3 aHelix->setAxisPoint(AcGePoint3d(
0,
0,
10));
4 aHelix->setAxisVector(AcGeVector3d(
0,
0,
1));
5 aHelix->setStartPoint(AcGePoint3d(
0,
20,
0));
6 aHelix->setBaseRadius(
20);
7 aHelix->setTopRadius(
10);
8 aHelix->
setTwist(Adesk::kTrue);
9
10 // case
11 aHelix->
setConstrain(AcDbHelix::kTurnHeight);
12 aHelix->setTurnHeight(
15);
13 aHelix->setHeight(
100);
// Turns = Height / TurnHeight
14
15 // case
16 aHelix->
setConstrain(AcDbHelix::kTurnHeight);
17 aHelix->setTurnHeight(
15);
18 aHelix->setTurns(
100);
// Height = TurnHeight * Turns
19
20 // case
21 aHelix->
setConstrain(AcDbHelix::kTurns);
22 aHelix->setTurns(
7);
23 aHelix->setHeight(
100);
// TurnHeight = Height / Turns
24
25 aHelix->
setConstrain(AcDbHelix::kTurns);
26 aHelix->setTurns(
7);
27 aHelix->setTurnHeight(
15);
// Height = TurnHeight * Turns
28
29 // case
30 aHelix->
setConstrain(AcDbHelix::kHeight);
31 aHelix->setHeight(
100);
32 aHelix->setTurns(
7);
// TurnHeight = Height / Turns
33
34 // case
35 aHelix->
setConstrain(AcDbHelix::kHeight);
36 aHelix->setHeight(
100);
37 aHelix->setTurnHeight(
15);
// Turns = Height / TurnHeight
38
39 aHelix->
createHelix();
40
41 acutPrintf(_T(
"StartPoint:%lf,%lf,%lf\n"),
42 aHelix->startPoint()[
0], aHelix->startPoint()[
1], aHelix->startPoint()[
2]);
// 0, 20, 10
43 acutPrintf(_T(
"slope:%lf total length:%lf\n"),
44 aHelix->turnSlope(), aHelix->
totalLength());
45
46 AcDbObjectPointer<AcDbLine>
xAxis;
47 AcDbObjectPointer<AcDbLine>
yAxis;
48 AcDbObjectPointer<AcDbLine>
zAxis;
49 xAxis.create();
50 yAxis.create();
51 zAxis.create();
52 AcCmColor color;
53 color.setRGB(
255,
0,
0);
54 xAxis->
setColor(color);
55 color.setRGB(
0,
255,
0);
56 yAxis->
setColor(color);
57 color.setRGB(
0,
0,
255);
58 zAxis->
setColor(color);
59 xAxis->setStartPoint(AcGePoint3d::kOrigin + AcGeVector3d(
0,
0,
10));
60 yAxis->setStartPoint(AcGePoint3d::kOrigin + AcGeVector3d(
0,
0,
10));
61 zAxis->setStartPoint(AcGePoint3d::kOrigin + AcGeVector3d(
0,
0,
10));
62 xAxis->setEndPoint(xAxis->startPoint() + AcGeVector3d(
20,
0,
0));
63 yAxis->setEndPoint(yAxis->startPoint() + AcGeVector3d(
0,
20,
0));
64 zAxis->setEndPoint(zAxis->startPoint() + AcGeVector3d(
0,
0,
100));
AcDbHelix Demo
标签: