PDA

View Full Version : VBA code to change view from iso to top?



RMS
10-01-2007, 05:27 AM
Hello Everyone!

Does anyone know the VBA line of code that will change an isometric view in model space to a top view??

I have searched and have come up empty?

Thanks,
Rob

fixo
10-04-2007, 03:02 AM
Hi Rob
Try to use SenCommand method
I think easiest one


Sub top()
ThisDrawing.SendCommand "-VIEW _TOP " '<--blank space after TOP
End Sub


~'J'~

RMS
10-04-2007, 06:01 AM
Hi Fatty:

Its not working, though it runs in the program without any VB errors.

any other ideas?

Thanks for the help!

Rob

lucas
10-04-2007, 07:32 AM
Hi Rob,
it works for me in 2005.
did you copy it exactly and paste it into a module?

fixo
10-04-2007, 09:32 AM
Hi Fatty:

Its not working, though it runs in the program without any VB errors.

any other ideas?

Thanks for the help!

Rob

Hay, Rob
Try this instead
Btw, I don't like SendCommand too because
this work differently in the different version
Here is adopted example from help


Sub Ch_ViewDir()
'
'based on Direction Property Example in the Help file
'
Dim vecDir(2) As Double
' Define the valid keywords
Dim keywordList As String
keywordList = "Top Bottom Right Left Front BAck"
' Call InitializeUserInput to setup the keywords
ThisDrawing.Utility.InitializeUserInput 1, keywordList
' ' Prompt the user to input any of the keywords. Return "Top" "Bottom" "Right" "Left" "Front" or "Back" in
' the returnString variable depending on whether the user input "T" or "t", "B" or "B", "BA" or "ba", etc. .
Dim response As String
response = ThisDrawing.Utility.GetKeyword("Choose a view direction (Top)(Bottom)(Right)(Left)(Front)(BAck): ")
'MsgBox response 'debug only
'
' Define the direction vector , depending on the returned view name.
Select Case response
Case "Top"
vecDir(0) = 0: vecDir(1) = 0: vecDir(2) = 1
Case "Bottom"
vecDir(0) = 0: vecDir(1) = 0: vecDir(2) = -1
Case "Right"
vecDir(0) = 1: vecDir(1) = 0: vecDir(2) = 0
Case "Left"
vecDir(0) = -1: vecDir(1) = 0: vecDir(2) = 0
Case "Front"
vecDir(0) = 0: vecDir(1) = -1: vecDir(2) = 0
Case "BAck"
vecDir(0) = 0: vecDir(1) = 1: vecDir(2) = 0
End Select
' Change the direction of the viewport so that you can
' view the change made. Once you change
' the direction, you must reset the active viewport.
With ThisDrawing
.ActiveViewport.Direction = vecDir
.ActiveViewport = .ActiveViewport
End With
ZoomExtents
End Sub


~'J'~

fixo
10-04-2007, 09:36 AM
Hi Rob,
it works for me in 2005.
did you copy it exactly and paste it into a module?

Hay, Lucas
Glad to hear again :)
Thanks for the testing
Regards,

Oleg

~'J'~

lucas
10-04-2007, 09:51 AM
Hi Oleg,
Same here, glad to see you still visiting the forum.

Zrob
10-07-2007, 09:16 PM
Hi Rob,
it works for me in 2005.
did you copy it exactly and paste it into a module?

Hey Lucas :hi:, yeah I did cut and paste :dunno not sure why it did not work.

How is everything in the guitar world!


Hay, Rob
Try this instead
Btw, I don't like SendCommand too because
this work differently in the different version
Here is adopted example from help

~'J'~

Wow, Fatty, thats a lot of code! When I get back to work on Tuesday I will give that a try. I was not sure what to search for in the AutoCAD VBA
object browser.

By the way, I have been super bussy learning the C++ and its going really
good so far, but lots to learn!

Thanks for the help guys!!
Rob

fixo
10-08-2007, 05:07 AM
Hi Rob
Unfortunatelly I am not so smart and not so young
to learn C++
I am enviuous on you by this reason :))
Anyway I have to try to learn VB.NET instead, it's
easier a bit for me
Have you succes on this way :)
Cheers

~'J'~

Zrob
10-08-2007, 08:06 AM
Hi Rob
Unfortunatelly I am not so smart and not so young
to learn C++
I am enviuous on you by this reason :))
Anyway I have to try to learn VB.NET instead, it's
easier a bit for me
Have you succes on this way :)
Cheers

~'J'~
Thanks Fatty, and good luck with the VB.NET !

I read an artical the other night about the .NET stuff, one thing that stuck out was it has the ability to combine or merge languges, so you can write in it with your favorite programing language, not sure if I got this correct but here is the artical:

"....NET should help with that; it provides an environment where multiple languages can seamlessly co-exist (even on the class inheritance chain, or during debugging). So there should be less pressure to develop products monolithically in a single language; you'll use whatever language suits the task/suits you." -see #19 at bottom of this interview:

http://www.cpp-home.com/index/tiki-read_article.php?articleId=3

its an old artical from 2002

Rob

lucas
10-08-2007, 08:13 AM
Hi Rob,
Alice N Chains unplugged @ Cains Ball Room in Tulsa 2 weeks from now....we have our tickets.
:biggrin:

Zrob
10-08-2007, 09:23 AM
Hi Rob,
Alice N Chains unplugged @ Cains Ball Room in Tulsa 2 weeks from now....we have our tickets.
:biggrin:

Wow, that band is incredable in two ways, there unpluged stuff is like no other rock band and when it comes to recording there hard rock stuff the guitars parts really just seem to stand out and jump out at ya... I don't know how to explain it I guess its just tallent all arround!

fixo
10-09-2007, 12:20 AM
Thanks Fatty, and good luck with the VB.NET !

I read an artical the other night about the .NET stuff, one thing that stuck out was it has the ability to combine or merge languges, so you can write in it with your favorite programing language, not sure if I got this correct but here is the artical:

"....NET should help with that; it provides an environment where multiple languages can seamlessly co-exist (even on the class inheritance chain, or during debugging). So there should be less pressure to develop products monolithically in a single language; you'll use whatever language suits the task/suits you." -see #19 at bottom of this interview:

http://www.cpp-home.com/index/tiki-read_article.php?articleId=3

its an old artical from 2002

Rob

Thanks Rob,

Interesting info btw

Good luck

~'J'~