Message 1 of 1
Dinamic block get angle between starpoint and endpoint line

Not applicable
08-27-2019
11:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have block dinamic propertis (angle and distance1)
I want to get angle from line (starpoint and endpoint)
For exampe i have starpoint of line
1,10,0 'xyz
Endpoint of line 10,20,0
I want angle of my dinamic block follow line angle ( or same as with angle line)
I has try code but angle not match with line
Dim oBlk As IAcadBlockReference2 Dim oProps As Variant Dim oDblkProp As AcadDynamicBlockReferenceProperty Dim vPick As Variant Dim I As Integer Dim ft(0) as integer,fd(0) as variant ft(0)=0:fd(0)="line" Dim ss as acadSelectionSet set ss = thisDrawing.selectionSet.add(now) ss.selectOnScreen ft,fd Dim L acadline Set L = ss.item(0) x = L.starPoint y =L.endPoint Myangle = atn(y(1)-x(1)/y(0)-x(0)) Set oBlk = ThisDrawing.ModelSpace.InsertBlock(x, "Test", 1#, 1#, 1#, 0#) If oBlk.IsDynamicBlock Then oProps = oBlk.GetDynamicBlockProperties For I = 0 To UBound(oProps) Set oDblkProp = oProps(I) If oDblkProp.PropertyName = "Angle" Then oDblkProp.Value =myangle Exit For End If Next End If