VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AcadLine.StartPoint not recognized

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
776 Views, 2 Replies

AcadLine.StartPoint not recognized

Hi everyone. I wrote the following code:

Dim ent As AcadEntity
Dim startpoint As Variant
Dim x As Double, y As Double, z As Double

For Each ent In Thisdrawing.modelspace

startpoint = AcadLine.startpoint
x = startpoint(0)
y = startpoint(1)
z = startpoint(2)

MsgBox x

AcadLine.startpoint always returns "0". Note that there are no capital letters in startpoint. The same thing happens when i'm looking for the endpoint. I could really use some help.

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

See my reply to your prev. post.

wrote in message news:5790614@discussion.autodesk.com...
Hi everyone. I wrote the following code:

Dim ent As AcadEntity
Dim startpoint As Variant
Dim x As Double, y As Double, z As Double

For Each ent In Thisdrawing.modelspace

startpoint = AcadLine.startpoint
x = startpoint(0)
y = startpoint(1)
z = startpoint(2)

MsgBox x

AcadLine.startpoint always returns "0". Note that there are no capital
letters in startpoint. The same thing happens when i'm looking for the
endpoint. I could really use some help.

thnx
Message 3 of 3
pdr0663
in reply to: Anonymous

Not sure where acadline gets initialized...

Here's what I would try:

 

Dim ent As AcadEntity

dim acLine as AcadLine
Dim startpoint As Variant
Dim x As Double, y As Double, z As Double

For Each ent In Thisdrawing.modelspace
if ent.ObjectName = "AcDbLine" then

  set acLine = ent
  startpoint = acLine.startpoint

 

  x = startpoint(0)
  y = startpoint(1)
  z = startpoint(2)

 

  MsgBox x

 

end if

 

next ent

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

Post to forums  

Autodesk Design & Make Report

”Boost