人在浆糊 发表于 2003-10-31 14:01:00

求助:在cad中用程序怎么实现输入两个三维点,输入半径,画一个圆柱体?

人在浆糊 发表于 2003-10-31 15:17:00

高手帮帮忙阿~~~,先谢了

01010101 发表于 2003-11-10 20:15:00

会调用lisp吧,给你编了个小程序,试试

mayankrr 发表于 2008-8-28 10:43:00

请问怎么用这个命令啊

陋室清风 发表于 2008-8-29 11:54:00

<p>载入后,打yz命令就可在指定位置画出圆柱体了。</p><p></p>

junhua1123 发表于 2008-9-2 21:10:00

<p>简单,画一个底面圆,然后根据两点画直线,拉伸,就可以了</p><p>程序:&nbsp;&nbsp;&nbsp; Dim intCount As Integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' 当前模型空间的对象数<br/>&nbsp;&nbsp;&nbsp; intCount = ThisDrawing.ModelSpace.Count<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; Dim ptCenter(2) As Double<br/>&nbsp;&nbsp;&nbsp; ptCenter(0) = x1: ptCenter(1) = y1: ptCenter(2) = h1<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; Dim objCircle(0) As AcadEntity<br/>&nbsp;&nbsp;&nbsp; Set objCircle(0) = AddCircle(ptCenter, r1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' 创建拉伸截面<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; ' 创建面域<br/>&nbsp;&nbsp;&nbsp; Dim objRegion As Variant<br/>&nbsp;&nbsp;&nbsp; objRegion = ThisDrawing.ModelSpace.AddRegion(objCircle)<br/>&nbsp;&nbsp;&nbsp; objCircle(0).Delete<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; Dim objLine As AcadLine, pt(2) As Double<br/>&nbsp;&nbsp;&nbsp; pt(0) = x2<br/>&nbsp;&nbsp;&nbsp; pt(1) = y2<br/>&nbsp;&nbsp;&nbsp; pt(2) = h2<br/>&nbsp;&nbsp;&nbsp; Set objLine = AddLine(ptCenter, pt)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' 创建拉伸路径<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; ' 沿路径拉伸面域<br/>&nbsp;&nbsp;&nbsp; Dim objSolid As Acad3DSolid<br/>&nbsp;&nbsp;&nbsp; Set objSolid = ThisDrawing.ModelSpace.AddExtrudedSolidAlongPath(objRegion(0), objLine)<br/>&nbsp;&nbsp;&nbsp; objLine.Delete<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; ' 删除已无用的面域<br/>&nbsp;&nbsp;&nbsp; Dim ent As AcadEntity<br/>&nbsp;&nbsp;&nbsp; If ThisDrawing.ModelSpace.Count &gt; intCount Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set ent = ThisDrawing.ModelSpace.Item(ThisDrawing.ModelSpace.Count - 2)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ent.Delete<br/>&nbsp;&nbsp;&nbsp; End If</p><p>大概这样,有些是自定义命令</p>

bct666 发表于 2008-9-16 10:15:00

画一条直线!取两端点!即可!另外渲染的铜棒还真好看!

小法师 发表于 2008-9-16 12:06:00

junhua兄,你的程序里应该还要增加改变面域的normal的语句,使面域的法向向量与直线相同。否则当直线不是竖直的时候,拉伸出来的不是圆柱。

旗木卡卡心 发表于 2012-9-21 10:14:04

小法师 发表于 2008-9-16 12:06 static/image/common/back.gif
junhua兄,你的程序里应该还要增加改变面域的normal的语句,使面域的法向向量与直线相同。否则当直线不是竖 ...

法师师兄,你有比较完整的程序么?能否给小弟参考参考,拜谢啦

丁X的 发表于 2014-6-20 17:00:00

这个不错,收藏了,谢谢楼主
页: [1] 2
查看完整版本: 求助:在cad中用程序怎么实现输入两个三维点,输入半径,画一个圆柱体?