clore 发表于 2003-7-14 08:41:00

我想把Polyline转为LightWightPolyline,请版主赐教!

本帖最后由 作者 于 2003-7-14 16:06:34 编辑

在CAD下List显示为Polyline,在VBA下显示为AcDbPolyFaceMesh,我想把它转为LightWightPolyline,有没办法,请版主赐教!
下面是DWG文件:

myfreemind 发表于 2003-7-14 23:27:00

先把plinetype参数的值改为2,然后重新画一条就可以了!

clore 发表于 2003-7-15 08:19:00

但是线条太多了,全部重画代价太大,用VBA怎么实现?

myfreemind 发表于 2003-7-15 23:41:00

当然要用VBA实现,本站有教程,在CAD下载!里面有用VBA创建pline线的方法!

myfreemind 发表于 2003-7-15 23:50:00

这个程序给你参考一下!原来差不多多,唯一的区别就是我这里是变直线,但多段线也差不多,只是把二维变为三维!

Sub jczx() '加粗直线程序

Dim sset As AcadSelectionSet
Dim Ftype(0) As Integer
Dim Fdata(0) As Variant
Dim i As Integer
Dim entity As AcadEntity
Dim plineobj As AcadLWPolyline
Dim spnt As Variant
Dim epnt As Variant
Dim ver(0 To 3) As Double


Ftype(0) = 0
Fdata(0) = "Line"

For i = 0 To ThisDrawing.SelectionSets.Count - 1
ThisDrawing.SelectionSets.Item(i).Clear
ThisDrawing.SelectionSets.Item(i).Delete
Next

Set sset = ThisDrawing.SelectionSets.Add("linesset")
sset.SelectOnScreen Ftype, Fdata
For Each entity In sset
spnt = entity.StartPoint
epnt = entity.EndPoint
ver(0) = spnt(0): ver(1) = spnt(1)
ver(2) = epnt(0): ver(3) = epnt(1) '

Set plineobj = ThisDrawing.ModelSpace.AddLightWeightPolyline(ver)
plineobj.ConstantWidth = 0.5
entity.Delete
Next



End Sub

lh_163 发表于 2003-7-22 15:17:00

试一试"convert"命令

myfreemind 发表于 2003-7-22 23:29:00

不错!
页: [1]
查看完整版本: 我想把Polyline转为LightWightPolyline,请版主赐教!