人人范文网 范文大全

工作中需要的CAD代码总结(优秀)

发布时间:2020-03-02 19:02:52 来源:范文大全 收藏本文 下载本文 手机版

1.遍历图层

Dim layer As AcadLayer For Each layer In ThisDrawing.Layers Next layer 2.获取指定图层

Dim CurrentLayer As AcadLayer Set CurrentLayer = ThisDrawing.Layers.Item(\"层名(或序号)\") 3.选择集构建(选择指定图层的文本对象) Dim acadApp As AcadApplication Dim acadDoc As AcadDocument

Private Sub Command1_Click() On Error Resume Next Set acadApp = GetObject(, \"AutoCAD.Application\") If Err Then Err.Clear Set acadApp = CreateObject(\"AutoCAD.Application\") End If

Set acadDoc = acadApp.ActiveDocument

Dim FType(0 To 1) As Integer Dim FData(0 To 1) As Variant

FType(0) = 0

FData(0) = \"TEXT\"

FType(1) = 8

FData(1) = \"GCJZ\"

Dim etobj As AcadSelectionSet Set etobj = acadDoc.SelectionSets.Add(\"test2\")

etobj.Select acSelectionSetAll, , , FType, FData

For Each pickedobjs In etobj pickedobjs.Color = acGreen

\'把选上的实体变成绿色 pickedobjs.Update Next etobj.Delete 4.遍历选择集

Dim ent As AcadEntity Dim color As New AcadAcCmColor color.ColorIndex = acRed For Each ent In ThisDrawing.ModelSpace If TypeOf ent Is AcadLine Then ent.TrueColor = color End If Next ent 5.动态创建多线段

Sub CreatePolylineBasic() On Error Resume Next Dim index As Integer index = 2

Dim pt1 As Variant pt1 = ThisDrawing.Utility.GetPoint(, \"输入第一点:\") If Err Then Err.Clear Exit Sub End If

Dim ptPrevious As Variant, ptCurrent As Variant ptPrevious = pt1

NEXTPOINT: ptCurrent = ThisDrawing.Utility.GetPoint(ptPrevious, \"输入下一点:\") If Err Then Err.Clear Exit Sub End If

Dim objPline As AcadLWPolyline If index = 2 Then Dim points(0 To 3) As Double points(0) = ptPrevious(0) points(1) = ptPrevious(1) points(2) = ptCurrent(0) points(3) = ptCurrent(1) Set objPline = ThisDrawing.ModelSpace.AddLightWeightPolyline(points) ElseIf index > 2 Then Dim ptvert(0 To 1) As Double ptvert(0) = ptCurrent(0) ptvert(1) = ptCurrent(1) objPline.AddVertex index - 1, ptvert End If index = index + 1 ptPrevious = ptCurrent GoTo NEXTPOINT End Sub 6.获取DXF组码 直接在命令行输入(entget(car(entsel))),或者在函数中ThisDrawing.SendCommand “(entget(car(entsel)))” 7.

工作中需要反思

工作中需要反思

CAD总结

工作中需要相互沟通

软件工程代码总结

营业执照、组织机构代码需要资料清单

工作中需要注意的细节

工作中需要改进的地方

关于学习CAD需要了解的

CAD制图总结

工作中需要的CAD代码总结(优秀)
《工作中需要的CAD代码总结(优秀).doc》
将本文的Word文档下载到电脑,方便编辑。
推荐度:
点击下载文档
相关专题 cad工作总结 优秀
点击下载本文文档