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

Userform position problem

7 REPLIES 7
Reply
Message 1 of 8
Anonymous
364 Views, 7 Replies

Userform position problem

Hello, I have a macro that picks points, in the userform I placed a command button thats executes that function, the problem is after I pick the point it moves me to the previous poisition of the userfrom when I clicked the command.

I have to move in the model space and I want keep the position while I am picking points.

7 REPLIES 7
Message 2 of 8
Alfred.NESWADBA
in reply to: Anonymous

Hi,

 

can you show the code where you start the pick multiple points?

Did you hide the form in the meantime, was it modal or not, ... all information necessary to help.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 8
Anonymous
in reply to: Alfred.NESWADBA

This is the code (same for the post before), removed the cases:

Public Sub cmdPreia_Click()
    Dim ok As Integer
    Dim varPnt As Variant
    frmInterfata.Hide
    varPnt = ThisDrawing.Utility.GetPoint(, MsjP)
    X = varPnt(0)
    Y = varPnt(1)
    Z = varPnt(2)
    Select Case cMsj
    End Select
    frmInterfata.show False
End Sub



 

Message 4 of 8
Alfred.NESWADBA
in reply to: Anonymous

Hi,

 

>> the problem is after I pick the point it moves me to the previous poisition of the userfrom

Maybe I misunderstand something, your code asks for one point and then it shows the form. That is how you created your code (hide the form - pick the point - show the form), what is the problem then?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 5 of 8
Anonymous
in reply to: Alfred.NESWADBA

Yes hide the form - pick the point - show the form, the problem is it hides the form then I need to pick the point but I move in the model space for example to find the desired point to pick but after I click it the userform appears but in the model space the position where I picked point doesn't remain, it moves me in the model space in the location where I was before I click the command button, I want to remain in the position where I picked the point in the model space.

Message 6 of 8
Alfred.NESWADBA
in reply to: Anonymous

Hi,

 

so you mean you do some PAN and ZOOM while you are in GetPoint-mode, then you left-click to get the point, that brings you back to the form and AutoCAD itself restores the view that was active before your PAN and ZOOM?

 

Then sorry to say, I can't reproduce that.

What AutoCAD version/service pack/if vertical which one are you using.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 7 of 8
Anonymous
in reply to: Anonymous

Yes that's what I mean, I want to use this macro for big drawings and I have to PAN and ZOOM and I don't want to PAN and ZOOM every time I pick a point, the purpose of the macro is to pick multiple points in a fast way.
I use AutoCAD 2013, anyways thank you.
Message 8 of 8
Alfred.NESWADBA
in reply to: Anonymous

Hi,

 

sorry, I can't reproduce it with 2013 too (tried it first with 2015).

I attached a mini-sample (no errorhandling or comments), load it, start it with VBARUN ==> StartForm and let's know if my code works or show the same issues.

Maybe a search for the current servicepack could help too?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)

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

Post to forums  

Autodesk Design & Make Report

”Boost