woodman78 发表于 2022-7-5 20:56:28

谢谢比格尔。我在办公室的时候会查一下。

woodman78 发表于 2022-7-5 21:00:44

谢谢Irm,但我想使用Lisp或其他代码自动化这个过程。

BIGAL 发表于 2022-7-5 21:01:49

理解VBA,看看它是如何工作的,只需要使用VLISP进行基本的重写,VLISP与etc有非常紧密的语法交叉,这就是它的基本工作原理。我的名单上有它重做,但由于它的工作和家伙们很高兴它在底部。
 
现在只需更改块名和2.8,即c-c距离。

cadplayer 发表于 2022-7-5 21:08:15

是你需要的吗
https://apps.exchange.autodesk.com/ACD/en/Detail/Index?id=appstore.exchange.autodesk.com:rotationblocksattributesonpolylinev2_windows32and64:en

woodman78 发表于 2022-7-5 21:09:52

比加尔,
 
我尝试加载您的dvb文件,但无法在ppload窗口中加载。我看不到它在运行。有什么想法吗?
 
谢谢

BIGAL 发表于 2022-7-5 21:14:40

检查dvb文件的路径,我必须编辑上面的行,因为我在发布时更改了它。如果目录名中有空格,请尝试类似p:\\my vba\\access-rev2的操作。dvb。
 
否则只需执行vbaman并加载access-rev2,然后您就可以执行(vl vbarun“draw\u vehicle”)
 
如果单击Access-rev2,然后选择Visual basic编辑器,它将显示代码,车轮之间的间距为3.05。请参见下面的rde,将其更改为间距并重新创建块保持架。
 

Sub draw_vehicle()
Dim CAR As String
Dim arcobj As AcadArc
Dim oPoly As AcadEntity
Dim blkobj As AcadEntity
Dim retVal As Variant
Dim snapPt As Variant
Dim oCoords As Variant
Dim blpnt1() As Variant
ReDim blpnt1(100)
Dim blpnt2() As Variant
ReDim blpnt2(100)
Dim vertPt(0 To 2) As Double
Dim Pt1(0 To 2) As Double
Dim Pt2(0 To 2) As Double
Dim newPt(0 To 2) As Double
Dim iCnt, w, x, y, z As Integer
Dim cRad, interval, blkangle As Double
Dim circObj As AcadCircle
Dim lineObj As AcadLine
On Error GoTo Something_Wrong
If ThisDrawing.ActiveSpace = acModelSpace Then
Set Thisspace = ThisDrawing.ModelSpace
Else: Set Thisspace = ThisDrawing.PaperSpace
End If
For Each Item In ThisDrawing.Blocks
If Item.Name = "holden" Then GoTo continue_on
Next Item
' insert holden block
InsertBlock "p:\Autodesk\vba\holdencar.dwg", 0
continue_on:
w = 1
ThisDrawing.Utility.GetEntity oPoly, snapPt, vbCr & "Select polyline :"
If oPoly.ObjectName = "AcDbPolyline" Then
oCoords = oPoly.Coordinates
Else: MsgBox "This object is not a polyline! Please do again"
Exit Sub
End If
interval = CDbl(InputBox("Enter interval:", , 1#))
If interval < 1 Then
interval = 1
End If
For iCnt = 0 To UBound(oCoords) - 2 Step 2
Pt1(0) = oCoords(iCnt): Pt1(1) = oCoords(iCnt + 1): Pt1(2) = 0#
newPt(0) = Pt1(0)
newPt(1) = Pt1(1)
newPt(2) = 0#
iCnt = iCnt + 2
Pt2(0) = oCoords(iCnt): Pt2(1) = oCoords(iCnt + 1): Pt2(2) = 0#
x = (Pt1(0) - Pt2(0)) / interval
y = (Pt1(1) - Pt2(1)) / interval
'reset back 2 values
iCnt = iCnt - 2
cRad = 3.05
startang = 4.71239
endang = 1.570796
CAR = "HOLDEN"
For z = 1 To interval
vertPt(0) = newPt(0) - x
vertPt(1) = newPt(1) - y
vertPt(2) = 0#
'blpnt1(w) = vertPt
'Set arcobj = ThisDrawing.ModelSpace.AddArc(vertPt, cRad, endang, startang)
Set arcobj = Thisspace.AddArc(vertPt, cRad, endang, startang)
retval2 = arcobj.IntersectWith(oPoly, acExtendOtherEntity)
arcobj.Delete
Set arcobj = Nothing
blkangle = ThisDrawing.Utility.AngleFromXAxis(retval2, vertPt)
'Set blkobj = ThisDrawing.ModelSpace.InsertBlock(vertPt, CAR, 1#, 1#, 1#, blkangle)
Set blkobj = Thisspace.InsertBlock(vertPt, CAR, 1#, 1#, 1#, blkangle)
Set blkobj = Nothing
w = w + 1
newPt(0) = newPt(0) - x
newPt(1) = newPt(1) - y
Next z
Next iCnt
GoTo Exit_out
Something_Wrong:
MsgBox Err.Description
Exit_out:
End Sub

woodman78 发表于 2022-7-5 21:18:12

嗨,比格尔,
 
我从李那里找到了一些非常接近我想要的东西。这是他的对象对齐命令。我唯一的问题是它没有将块与多段线对齐(请参见附图)。可以修改此选项(经Leemac允许)以将夹点从块向下旋转到多段线上吗?
 
谢谢
 
ObjectAlignV1-3。lsp

BIGAL 发表于 2022-7-5 21:19:46

手动在第二个点的另一个点绘制圆心,并旋转块以适应vba的操作。还是不知道为什么你不能去工作,试试霍尔顿。图纸
 
有一天会重写到VLISP。
页: 1 [2]
查看完整版本: Lisp沿po旋转块