VB GetPoint Errors (NOT VBA)

VB GetPoint Errors (NOT VBA)

Anonymous
Not applicable
888 Views
5 Replies
Message 1 of 6

VB GetPoint Errors (NOT VBA)

Anonymous
Not applicable
Hi.

I am writing the following VB (NOT VBA) Activex DLL to get a Point on the
drawing area, thru a Visual Basic Form, using a Command in Vusal Lisp.

I have a simple form with a one button:

VISUAL BASIC ACTIVEX DLL

Class Code: Class Name: mSlides

Public Sub SlideLib()
Set frmTest = New frmSlides
frmTest.Show vbModal
While caso = 1
BuscarPunto
frmTest.Show vbModal
Wend
Unload frmTest
End Sub

Module CODE:

Sub BuscarPunto()
Dim PUNTO As Variant
MsgBox "Donde lo desea insertar", vbOKOnly
PUNTO = ThisDrawing.Utility.GetPoint(, "Seleccione un Punto")
End Sub

Form CODE:

Private Sub Form_Load()
Set acadApp = GetObject(, "AutoCAD.Application")
Set ThisDrawing = acadApp.ActiveDocument
End Sub

Private Sub Slide_ButtonClk()
caso = 1
Unload Me
End Sub

This is my VisualLisp Program

(defun c:slides ()
(vl-load-com)
(setq acd (vlax-get-acad-object))
(setq srv (vlax-invoke acd "getinterfaceobject" "HRTSLIDELIB.mSlides"))
(setq ret (vlax-invoke srv "slidelib"))
)

I have several questions:

1. Why do I have to use the Instruction:
MsgBox "Donde lo desea insertar", vbOKOnly
in my Code, If I don`t put this instruction the AutoCAD2002 hangs up.

2. Why do I have to use the while in my Code, I have been Unable to write
the Slide_Button Click as follows:

Private Sub Slide_ButtonClk()
Unload Me
BuscarPunto
frmTest.Show vbModal
End Sub

If I write this code AutoCAD2002, hangs up.

So in resume,

I would like tow write an ActiveX DLL, with a form, and a button , which
lets me pick a point in the drawing area and the return to the form.

Sorry for my English
Caracas-Venezuela

I need help, the program is working but it doesn't look natural.
0 Likes
889 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Hi Tomas,

I will load your code up, try it and see what happens. Until then, or
someone else gives you a better option, try using a vba program to
access the DLL instead of vlisp. I always use a dvb file to access and
run vb dlls.

Mike
===============================
Mike Tuersley
PhD @ CADalyst's AutoCAD Clinic
http://www.cadonline.com
0 Likes
Message 3 of 6

Speed_CAD
Collaborator
Collaborator
Hola Tomas...

Como eres de venezuela te contesto en español:

Lo que puedes hacer es en VB declarar dos variables publicas una de tipo varint y otra de tipo Boolean, por ejemplo:

Public vbPunto As Variant
Public vbAceptar As Boolean

Y en el boton del cual deseas obtener el punto la asignas a la variable vbAceptar = True, y desde Visual Lisp verificas el dato de la variable vbAceptar, por ejemplo:

(if (= (vlax-get-property srv 'vbAceptar) :vlax-true)
(progn
(setq punto (getpoint "\nSeleccione punto: "))
...aqui debes volver al formulario de VB...
)
)

Entonces los valores de punto se los asignas a vbPunto, pero antes debes crear una variable en Visual Lisp con safearray y asi desde Visual Basic podras leer cada coordenda del punto con vbPunto(0) para X, vbPunto(1) para Y y vbPunto(2) para Z.

Yo lo hago de esa forma, en este momento no tengo a mano el codigo completo pero te dejo la idea para que lo hagas...

Un saludo de SpeeCAD... 🙂
CHILE
FORO: http://www.hispacad.com/foro
Mauricio Jorquera
0 Likes
Message 4 of 6

Anonymous
Not applicable
Umm...SpeedCAD, do you know you're replying to a message that is a year and a half old?
0 Likes
Message 5 of 6

Speed_CAD
Collaborator
Collaborator
Yep... I know it wivory, but this message did not have answer.

excuse me 😞
Mauricio Jorquera
0 Likes
Message 6 of 6

Anonymous
Not applicable
Certainly no need to apologise - I just thought maybe you didn't realise.
0 Likes