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

Basepoint Autocad to vba

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Demasure1
675 Views, 3 Replies

Basepoint Autocad to vba

Hello

 

How can i get a basepoint of Autocad into 2 textboxes in vba? 

I have a button to pick a point into Autocad

And next to that i have 2 textboxes:

1 for the x.value

2 for the y.value

 

Ill send you a picture of my frame.

 

How can i do this? the code i have already is: 

Private Sub cmdInsertVAZ_Click()

If frmKast.chkCoGeavanceerd And frmKast.chkVooraanzicht = True Then
Call Mod_VarFormules
Call Mod_VAZGeavanceerd
Call Mod_VAZGeavanceerd2
Call Mod_VAZAlgemeen
MsgBox " Geef het BASISPUNT voor het VOORAANZICHT in aub."
InvoegpuntVAZ = ThisDrawing.Utility.GetPoint(, vbCr & "Insertion point: ")
frmKast.Show
End If


End Sub

 

thanks

3 REPLIES 3
Message 2 of 4
kasperwuyts
in reply to: Demasure1

'add x coordinate to textbox

Textbox1.text = invoegpuntVaz(0)

'add y coordinate to textbox

Textbox2.text = invoegpuntVaz(1)


Best regards
Kasper Wuyts
_______________________________________________________________________________
If this post solves your problem, clicking the 'accept as solution' button would be greatly appreciated.
Message 3 of 4
Demasure1
in reply to: kasperwuyts

How do i need to at this in my program? if i add it in the end i get a compile error 

 

Message 4 of 4
kasperwuyts
in reply to: Demasure1

Add a sub in the code of your form. The three points should be defined at the beginning of the code, before any subs:

Dim InvoegpuntVAZ(0 to 2) as double
Dim InvoegpuntZAZ(0 to 2) as double
Dim InvoegpuntBAZ(0 to 2) as double

Let's suppose your first 'Handmatig' button is called cmdVooraanzichtHandmatig. The textbox that should contain the X-coordinate here is called txtVooraanzichtX, the one containing the Y-coordinate is called txtVooraanzichtY

You would have a sub like this:

 

Sub cmdVooraanzichtHandmatig_Click()

Me.hide

Application.Visible = True
InvoegpuntVAZ = ThisDrawing.Utility.GetPoint(, " Geef het BASISPUNT voor het VOORAANZICHT in aub.")

'add x coordinate to textbox
txtVooraanzichtX.Text = InvoegpuntVAZ(0)
'add y coordinate to textbox
txtVooraanzichtY.Text = InvoegpuntVAZ(1)

Me.show

End Sub

 

Then you can copy the sub two times, simply replacing 'Vooraanzicht' with 'Zijaanzicht', 'invoegpuntVAZ' with 'invoegpuntZAZ' etcetera

I've added a working sample in a dwg.


Best regards
Kasper Wuyts
_______________________________________________________________________________
If this post solves your problem, clicking the 'accept as solution' button would be greatly appreciated.

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

Post to forums  

Autodesk Design & Make Report

”Boost