VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 3
Anonymous
99 Views, 2 Replies

Entity

How can I get the startpunkt and the endpoint of a selected line ?, so far
my code is:

dim endpoint1 as variant
dim startpoint1 as variant

ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"


returnObj.Color = acByLayer
returnObj.Update

?? endpoint1 = returnObj.endPoint
?? startpoint1 = returnObj.startPoint

???
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Sub a()
' add declaration for returnObj and basePnt
Dim returnObj As AcadLine
Dim basePnt As Variant
Dim endpoint1 As Variant
Dim startpoint1 As Variant

ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"
returnObj.Color = acByLayer
returnObj.Update

endpoint1 = returnObj.EndPoint
startpoint1 = returnObj.StartPoint

MsgBox "Start point is X" & startpoint1(0) & ", Y" & startpoint1(1) & ",
Z" & startpoint1(2)
MsgBox "End point is X" & endpoint1(0) & ", Y" & endpoint1(1) & ", Z" &
endpoint1(2)

' to limit output to 4 decimals
MsgBox "Start X = " & Format(startpoint1(0), "###0.0000")
End Sub

You might want to include Option Explicit at the top of your module.

hth





"HVJ" wrote in message
news:11B5362D64845C79EF2DE969547C9BC6@in.WebX.maYIadrTaRb...
> How can I get the startpunkt and the endpoint of a selected line ?, so
far
> my code is:
>
> dim endpoint1 as variant
> dim startpoint1 as variant
>
> ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"
>
>
> returnObj.Color = acByLayer
> returnObj.Update
>
> ?? endpoint1 = returnObj.endPoint
> ?? startpoint1 = returnObj.startPoint
>
> ???
>
>
Message 3 of 3
Anonymous
in reply to: Anonymous

Thank you, that's just what I was looking for.


"Keith" skrev i en meddelelse
news:0F566C7606DA26D50229B416E0B778C8@in.WebX.maYIadrTaRb...
> Sub a()
> ' add declaration for returnObj and basePnt
> Dim returnObj As AcadLine
> Dim basePnt As Variant
> Dim endpoint1 As Variant
> Dim startpoint1 As Variant
>
> ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"
> returnObj.Color = acByLayer
> returnObj.Update
>
> endpoint1 = returnObj.EndPoint
> startpoint1 = returnObj.StartPoint
>
> MsgBox "Start point is X" & startpoint1(0) & ", Y" & startpoint1(1) &
",
> Z" & startpoint1(2)
> MsgBox "End point is X" & endpoint1(0) & ", Y" & endpoint1(1) & ", Z"
&
> endpoint1(2)
>
> ' to limit output to 4 decimals
> MsgBox "Start X = " & Format(startpoint1(0), "###0.0000")
> End Sub
>
> You might want to include Option Explicit at the top of your module.
>
> hth
>
>
>
>
>
> "HVJ" wrote in message
> news:11B5362D64845C79EF2DE969547C9BC6@in.WebX.maYIadrTaRb...
> > How can I get the startpunkt and the endpoint of a selected line ?, so
> far
> > my code is:
> >
> > dim endpoint1 as variant
> > dim startpoint1 as variant
> >
> > ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"
> >
> >
> > returnObj.Color = acByLayer
> > returnObj.Update
> >
> > ?? endpoint1 = returnObj.endPoint
> > ?? startpoint1 = returnObj.startPoint
> >
> > ???
> >
> >
>
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost