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

pick point returns zero

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
truss_85
723 Views, 10 Replies

pick point returns zero

Hi everyone,

 

I am stuck something with get Entity.

3 element array Pt always turned with zero values what ever I select.

 

here is my code please help...

 

 

Dim oEnt As AcadEntity
Dim Pt(0 To 2) As Double
ThisDrawing.Utility.GetEntity oEnt, Pt, "choose something"

 

 

10 REPLIES 10
Message 2 of 11
Hallex
in reply to: truss_85

Must be a variant type

Dim Pt  As variant
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 11
truss_85
in reply to: truss_85

Thanks for your answer

but pt as variant is worse then double

it returns empty matrix

 

is there any idea?

Message 4 of 11
AubelecBE
in reply to: truss_85

 

it is from the help of vba in acad :

Dim returnObj As AcadObject

Dim basePnt As Variant

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

 

Message 5 of 11
truss_85
in reply to: AubelecBE

yes it is

I know that and I applied basepoint as variant 

nothing change my friend.

I get basepoint matrix empty.

I need solution.

 

Message 6 of 11
AubelecBE
in reply to: truss_85

hi. have you

Dim oEnt As AcadEntity   >>> change for AcadObject

 

not working ?

 

Or check the point of this entity with the baee property of autocad. it is the same?

If your entity picked is (0,0) so is good

 

 

Message 7 of 11
truss_85
in reply to: AubelecBE

thanks for quick responding

yes i changed like you say

as variant i can get a matrix with empty values

as double i can get 0 matrix

 

i do not understand if i get 0 matrices is good please explain that.

 

Message 8 of 11
bojko108
in reply to: truss_85

This works for me, it return not 0 but actually values at the clicked location. Even if you declare object as AcadEntity or AcadObject

 

Dim returnObj As AcadObject
Dim basePnt As Variant
ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"
    MsgBox basePnt(0) & vbNewLine & _
                  basePnt(1) & vbNewLine & _
                  basePnt(2)

Message 9 of 11
truss_85
in reply to: bojko108

thanks it is work me too

 

Message 10 of 11
bojko108
in reply to: truss_85

Why you need this information. Your variable Pt will contain coordinates of the crosshair at the time of selection not coordinates of the object that you pick. You can use object.Coordinates method for coordinates of the object.

Message 11 of 11
truss_85
in reply to: bojko108

I need both coordinates of objet and the pick point

I use it for a long polyline that I want to take the slopes between specific vertices.

Designers must decide which vertices are suitable or best fit.

For this reason, I need that a specific point without coordinates of the object with one click.

I use both coordinates and pick point.

Anyway it is my solution to solve the problem and it works.

But any shorter and easier suggestions acceptable.

Thanks again.

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

Post to forums  

Autodesk Design & Make Report

”Boost