No more VBA in 2010? What do us utility programming drafters do?

No more VBA in 2010? What do us utility programming drafters do?

Anonymous
Not applicable
1,753 Views
37 Replies
Message 1 of 38

No more VBA in 2010? What do us utility programming drafters do?

Anonymous
Not applicable
It appears that as of 2010 AutoCAD will no longer have VBA. I can download it separately, but it doesn't sound like AutoCAD will be returning to VBA, so I am only delaying the inevitability of VBA programs that no longer work. I took a look at VB.net converting and it is different enough to give me an immediate headache. It seems to be an external programming language designed more for full time programmers than VBA was. I'm a drafter who also knows how to program in AutoLISP and VBA and write the occasional utility program, but not all that often. I am not sure how to proceed here.
As long as I'm on the subject, what happend to Visual Basic? Did it become VB.net? Will drafters with a little programming knowhow be limited to trying to squeeze out as much as they can from AutoLISP?
There have to be other drafters like myself running into the same problem, so any advice that people more familiar with these changes would be very helpful. I'm not sure that taking a bunch of classes on VB.net so that I can write one routine a year that is only appreciated by drafters would fly.
0 Likes
1,754 Views
37 Replies
Replies (37)
Message 2 of 38

Anonymous
Not applicable
Hi Aphyosemion,

VBA will be around for a long time yet. The more complaints they get
the more likely it is that they may re-include it in the AutoCAD build
as they do with Civil 3D 2010. You may remember that there were rumours
of the demise of Lisp around about the year 2000. User wrath at this
ensured that lisp is still around.

However, unlike lisp, VBA is limited by the fact that it is 32Bit
technology and will NEVER be upgraded to 64 bit.

Microsoft abandoned it and started a new programming paradigm .NET and
longer term you will have to use it or lisp or something yet to be invented.

There is a product VSPA which is essentially .NET VB inside a product -
similar to VBA. There are strong rumours that Autodesk will eventually
add this to AutoCAD

Regards,


Laurie Comerford


Aphyosemion wrote:
> It appears that as of 2010 AutoCAD will no longer have VBA. I can
> download it separately, but it doesn't sound like AutoCAD will be
> returning to VBA, so I am only delaying the inevitability of VBA
> programs that no longer work. I took a look at VB.net converting and it
> is different enough to give me an immediate headache. It seems to be an
> external programming language designed more for full time programmers
> than VBA was. I'm a drafter who also knows how to program in AutoLISP
> and VBA and write the occasional utility program, but not all that
> often. I am not sure how to proceed here. As long as I'm on the subject,
> what happend to Visual Basic? Did it become VB.net? Will drafters with a
> little programming knowhow be limited to trying to squeeze out as much
> as they can from AutoLISP? There have to be other drafters like myself
> running into the same problem, so any advice that people more familiar
> with these changes would be very helpful. I'm not sure that taking a
> bunch of classes on VB.net so that I can write one routine a year that
> is only appreciated by drafters would fly.
0 Likes
Message 3 of 38

Anonymous
Not applicable
I don't know, would you say the best option is to stall as long as I can by downloading VBA and installing it on everyone's computer that uses my routines, or get started learning VB.net so that I can write the occasional utility? I have also seen OpenDCL mentioned, but I'm not familiar with it. There was always AutoLISP as the only real option for routines in AutoCAD until VBA came out as a much more powerful option. Now it seems like my choices are much cloudier considering I am not a full time programmer, but a drafter who programs with a mouse in one hand and a programming manual in the other.
0 Likes
Message 4 of 38

Anonymous
Not applicable

I'd like to hope they would keep vba around until
one for the newer programs are installed with autocad. I'm in the same boat
having tons of vba utilities and having to learn dot net to keep moving forward.
it's a lot of work upgrading to dot net.

 

john coon


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
don't know, would you say the best option is to stall as long as I can by
downloading VBA and installing it on everyone's computer that uses my
routines, or get started learning VB.net so that I can write the occasional
utility? I have also seen OpenDCL mentioned, but I'm not familiar with it.
There was always AutoLISP as the only real option for routines in AutoCAD
until VBA came out as a much more powerful option. Now it seems like my
choices are much cloudier considering I am not a full time programmer, but a
drafter who programs with a mouse in one hand and a programming manual in the
other.
0 Likes
Message 5 of 38

Anonymous
Not applicable

I think you should continue using VBA and begin to
learn .NET as your time permits. 

 

 VBA will be around for a long time.  I
read that MS will still include VBA in the next version of
office.

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
don't know, would you say the best option is to stall as long as I can by
downloading VBA and installing it on everyone's computer that uses my
routines, or get started learning VB.net so that I can write the occasional
utility? I have also seen OpenDCL mentioned, but I'm not familiar with it.
There was always AutoLISP as the only real option for routines in AutoCAD
until VBA came out as a much more powerful option. Now it seems like my
choices are much cloudier considering I am not a full time programmer, but a
drafter who programs with a mouse in one hand and a programming manual in the
other.
0 Likes
Message 6 of 38

iwafb
Advisor
Advisor
I finally caved in to pressure about 1 year ago to learn VBA. Prior to that I have been programming in LISP. Like you, I am a draftsman first, programmer second. So, you can imagine how I felt in finding out the good news. All I can say is: Autodesk, PLEASE restore VBA in 2010 and beyond until something suitable comes along. VB.net just seems too hard core at this stage....
0 Likes
Message 7 of 38

Anonymous
Not applicable
I'm biting the bullet now, and it doesnt taste as bad as id thought. It's still very VB-ish, it feels sorta like -everything- is OLE, but thats where a lot of my VBA stuff was done anyway . Im sure Ill like it as soon as I can stop trying to figure out -how- to do stuff, and can start concentrating on -which way- I want to do stuff.

besides, I'd gotten rusty on my "Hello World" apps....
0 Likes
Message 8 of 38

Anonymous
Not applicable

We can always vote with our wallets. You drop VBA,
we drop subscription...


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">


I'd like to hope they would keep vba around until
one for the newer programs are installed with autocad. I'm in the same
boat having tons of vba utilities and having to learn dot net to keep moving
forward. it's a lot of work upgrading to dot net.

 

john coon


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
don't know, would you say the best option is to stall as long as I can by
downloading VBA and installing it on everyone's computer that uses my
routines, or get started learning VB.net so that I can write the occasional
utility? I have also seen OpenDCL mentioned, but I'm not familiar with it.
There was always AutoLISP as the only real option for routines in AutoCAD
until VBA came out as a much more powerful option. Now it seems like my
choices are much cloudier considering I am not a full time programmer, but a
drafter who programs with a mouse in one hand and a programming manual in
the other.
0 Likes
Message 9 of 38

patrick.emin
Alumni
Alumni
There is a product VSPA which is essentially .NET VB inside a product -

similar to VBA. There are strong rumours that Autodesk will eventually

add this to AutoCAD



This is actualy VSTA, Visual Studio Tools for Applications.

Patrick Emin animateur de la communauté francophone


Vous avez trouvé un message utile? Alors donnez un "J'aime" à ce message!
Votre question a eu une réponse satisfaisante? Voulez vous avoir l'amabilité de cliquer sur le bouton
 APPROUVER LA SOLUTION  en bas de la réponse qui apporte une solution?
Signez notre Livre d'Or
0 Likes
Message 10 of 38

Anonymous
Not applicable
Aphyosemion wrote:

> took a look at VB.net converting and it is different enough to give
> me an immediate headache.

Keep banging your head against that wall. Before you know it a hole
will appear and a whole new world will appear on the horizon. After you
get there you will never look back!

Try to remember when you first started on whatever you are comfortable
with now. At first it was very difficult, but the more you worked at
it, the easier it got!

Terry
0 Likes
Message 11 of 38

Anonymous
Not applicable
This will add additional cost to companies if they cannot use Visual Studio Express and have to purchase the full version of Visual Studio or Visual Basic. Then there is the additional training cost of turning Autocad technicians and managers into full fledge .Net Programmers. Seems an potentially expensive endeavor.

Autodesk should provide either VSPA or an IDE (Integrated Development Environment) with the the Autocad Products so that companies do not have to add Microsoft Development licensing.
0 Likes
Message 12 of 38

muckmailer
Collaborator
Collaborator
I think this code is closer to what I want but I am wondering if there is other drawing entities
that this drawing does not account for in color change.

So far I tryed view port layers out of the picture but maybe I should not. As far as
x-refs I think the program should skip them becuase they belong to other people
on the server.

Private Sub CommandButton1_Click()
Dim ent As AcadEntity
Dim layer As AcadLayer
Dim Color As String
For Each ent In ThisDrawing.ActiveLayout.Block
Debug.Print ent.ObjectName
For Each layer In ThisDrawing.Layers 'Thur Layer Collection for color
If ent.layer = layer.Name Then
Debug.Print ent.layer
Color = CStr(layer.TrueColor.ColorIndex)
End If
Next layer
If "AcDbBlockReference" = ent.ObjectName Then 'looks for blocks
BlockDefination
Else 'Entities outside of blocks
If OptionButton1.Value = True Then ent.Color = Color 'Case 1
If OptionButton2.Value = True Then ent.Color = Color 'Case 2
If OptionButton3.Value = True Then ent.Color = TextBox1.Text 'Case 3 Color by textbox.
End If
Next ent
End Sub

Public Sub BlockDefination()
Dim objBlock As AcadBlock
For Each objBlock In ThisDrawing.Blocks
Set blk = ThisDrawing.Blocks(objBlock.Name)
Set objLayers = ThisDrawing.Layers
Debug.Print blk.Name

If Not blk Is Nothing Then
Debug.Print blk.Name
For Each blkent In blk


For intI = 0 To objLayers.Count - 1
Set objLayer = objLayers(intI)

Debug.Print objLayer.Name
'Assign Block Entity a Color
Debug.Print blkent.Color
Debug.Print objLayer.Name

If blkent.Color = acByLayer And objLayer.Name = 0 Then
'If blkent.Color = 256 And objLayer.Name = 0 Then
If OptionButton1.Value = True Then blkent.Color = acByBlock 'Case 1
If OptionButton2.Value = True Then blkent.Color = ent.Color 'Case 2
End If
If blkent.Color = acByLayer Or blkent.Color = acByBlock Then
If OptionButton3.Value = True Then blkent.Color = TextBox1.Text 'Case 3 Color by text box
End If
Next ' Layer Loop
Next ' Block entities Foreach
End If 'Block Nothing
Next 'Drawing blocks Foreach
End Sub Edited by: muckmailer on Jul 13, 2009 12:35 AM
0 Likes
Message 13 of 38

Anonymous
Not applicable
Hi muckmailer,

This code is so inefficient that it it hard to believe that it is being
put forward as a solution to anything.

Just to look at one piece of it:
{code}
For Each layer In ThisDrawing.Layers 'Thur Layer Collection for color
If ent.layer = layer.Name Then
Debug.Print ent.layer
Color = CStr(layer.TrueColor.ColorIndex)
End If
Next layer

{code}

you could replace this with:
{code}
Color = CStr(ent.layer.TrueColor.ColorIndex)
{code}

Even if you didn't do this, you could make it better by:
{code}
For Each layer In ThisDrawing.Layers 'Thur Layer Collection for color
If ent.layer = layer.Name Then
Debug.Print ent.layer
Color = CStr(layer.TrueColor.ColorIndex)
Exit For ' Now you've set the colour why bother with all the other layers
End If
Next layer


{code}

Also look at the code I supplied for creating SelectionSets. It will
speed up the operation of the code significantly by making it more
efficient.

Regards,


Laurie Comerford


muckmailer wrote:
> I think this code is closer to what I want but I am wondering if there is other drawing entities
> that this drawing does not account for in color change.
>
> So far I tryed view port layers out of the picture but maybe I should not. As far as
> x-refs I think the program should skip them becuase they belong to other people
> on the server.
>
> Private Sub CommandButton1_Click()
> Dim ent As AcadEntity
> Dim layer As AcadLayer
> Dim Color As String
> For Each ent In ThisDrawing.ActiveLayout.Block
> Debug.Print ent.ObjectName
> For Each layer In ThisDrawing.Layers 'Thur Layer Collection for color
> If ent.layer = layer.Name Then
> Debug.Print ent.layer
> Color = CStr(layer.TrueColor.ColorIndex)
> End If
> Next layer
> If "AcDbBlockReference" = ent.ObjectName Then 'looks for blocks
> BlockDefination
> Else 'Entities outside of blocks
> If OptionButton1.Value = True Then ent.Color = Color 'Case 1
> If OptionButton2.Value = True Then ent.Color = Color 'Case 2
> If OptionButton3.Value = True Then ent.Color = TextBox1.Text 'Case 3 Color by textbox.
> End If
> Next ent
> End Sub
>
> Public Sub BlockDefination()
> Dim objBlock As AcadBlock
> For Each objBlock In ThisDrawing.Blocks
> Set blk = ThisDrawing.Blocks(objBlock.Name)
> Set objLayers = ThisDrawing.Layers
> Debug.Print blk.Name
>
> If Not blk Is Nothing Then
> Debug.Print blk.Name
> For Each blkent In blk
>
>
> For intI = 0 To objLayers.Count - 1
> Set objLayer = objLayers(intI)
>
> Debug.Print objLayer.Name
> 'Assign Block Entity a Color
> Debug.Print blkent.Color
> Debug.Print objLayer.Name
>
> If blkent.Color = acByLayer And objLayer.Name = 0 Then
> 'If blkent.Color = 256 And objLayer.Name = 0 Then
> If OptionButton1.Value = True Then blkent.Color = acByBlock 'Case 1
> If OptionButton2.Value = True Then blkent.Color = ent.Color 'Case 2
> End If
> If blkent.Color = acByLayer Or blkent.Color = acByBlock Then
> If OptionButton3.Value = True Then blkent.Color = TextBox1.Text 'Case 3 Color by text box
> End If
> Next ' Layer Loop
> Next ' Block entities Foreach
> End If 'Block Nothing
> Next 'Drawing blocks Foreach
> End Sub
>
> Edited by: muckmailer on Jul 13, 2009 12:35 AM
0 Likes
Message 14 of 38

Anonymous
Not applicable
But here's the rub, for simple utility programming drafters like me ....
For Each layer In ThisDrawing.Layers 'Thur Layer Collection for color
If ent.layer = layer.Name Then
Debug.Print ent.layer
Color = CStr(layer.TrueColor.ColorIndex)
End If
Next layer

tells me what's going on
, whereas what does this tell me (even if it is better programming)
Color = CStr(ent.layer.TrueColor.ColorIndex)



0 Likes
Message 15 of 38

Anonymous
Not applicable
Hi peter,

It tells you that for a given entity you can get its layer directly and
from the layer you can get the TrueColor.ColorIndex value and convert
the whole lot to a string with one operation instead of possibly
hundreds of actions.

With your more complex code, I had to study it to see what it was doing.
Finally I've given up bothering to work out what you want.

"You can lead a horse to water, but you can't make it drink"

Regards,


Laurie Comerford


petercharles wrote:
> But here's the rub, for simple utility programming drafters like me ....
> |For Each layer In ThisDrawing.Layers 'Thur Layer Collection for color
> If ent.layer = layer.Name Then
> Debug.Print ent.layer
> Color = CStr(layer.TrueColor.ColorIndex)
> End If
> Next layer
>
> tells me what's going on ||, whereas what does this tell me (even if it
> is better programming)
> Color = CStr(ent.layer.TrueColor.ColorIndex) |
> |
>
> |
0 Likes
Message 16 of 38

awerning
Advocate
Advocate
Getting back to the point of this thread...I don't understand why VBA coders don't use the VLISP environment anyway. You can use ALL the ActiveX (VBA) code from within a LISP routine. In fact, you can practically rewrite your VBA code verbatim into LISP code. Unfortunately there is not much documentation on it. But once you figure it out it is VERY self explanatory. The benefits are that you can use all the code options available to VBA\LISP\VLISP all in the same environment. On this note, there is NOTHING that VBA does that I can't program verbatim into LISP code.

If anyone is interested I can always point you toward the free documentation (that you already have) on writing ActiveX code from within LISP. Edited by: awerning on Jul 13, 2009 1:55 PM
0 Likes
Message 17 of 38

Anonymous
Not applicable
>>.I don't understand why VBA coders don't use the VLISP environment anyway.
>>On this note, there is NOTHING that VBA does that I can't program verbatim into LISP code.

Ok, well, port my Solidworks addins then, will you? How about my AlphaCAM toolpath generator? No? Maybe just a simple standalone .exe?

For me, AutoCad vba is just one more avenue that i can use to leverage my VB experience. And once I get up to speed in .NET, I will be able to use that to leverage VSTO, etc.

Im not knocking lisp. hell, the language is optimized for acad. But VB is everywhere. And so are my employers ideas of where i should be coding next. I can drop modules of code, written in Excel, and they will run in acad without modifying a line. As a matter of fact, ive posted such code here.

I wish, i really wish, I had the time to get -good- at lisp. But i dont. For what i have to do, i get the most mileage from VB. In a sense, we're both saying the same thing here - that when you're good with a hammer, everything starts looking like a nail.
0 Likes
Message 18 of 38

awerning
Advocate
Advocate
I agree with you there...I was specifically speaking of programmers that know AutoCAD VBA only. If you are vested in VB then thats a whole different story.

On that note...if you are doing the VB and\or VB.NET why aren't you leaning towards the ObjectARX outlet rather than VBA?
0 Likes
Message 19 of 38

Anonymous
Not applicable
same reason, really... portability, reusable code... coding in ARX would be a dream for me.

But my employers wouldnt spring for a compiler - hell, they are scared enuff with interpreted code that calls the API. They wouldnt even allow me to install VB Express... I had to install SharpDevelop, cause I could secretly install it without Admin privs. ... so recompiling code for every new acad release is a "pleasure" that Ill never experience.

[edit: Just realized that my sharpDevelop install is not longer secret 😕 ] Edited by: rocheey on Jul 13, 2009 9:35 PM
0 Likes
Message 20 of 38

Anonymous
Not applicable
Hi awerning,

Why don't I code in Lisp:

VBA requires less typing.

The intellisense of the VBA editor limits the opportunity for typing errosr.

Using Declared variables helps avoid typing errors.

The Debugging tools are far easier to use.

I don't have to keep track of bracket sets.

The help files are written for VBA and I don't have to read the extra
documentation or have it constantly on hand while I'm working.

I don't want to have to read the help in VBA, then look up and
accurately type the translation into a dumb editor.

There is no way I would ever go back to the T-Model Ford editor for VLisp.

When I move it will be to .NET

Regards,


Laurie Comerford


awerning wrote:
> Getting back to the point of this thread...I don't understand why VBA coders don't use the VLISP environment anyway. You can use ALL the ActiveX (VBA) code from within a LISP routine. In fact, you can practically rewrite your VBA code verbatim into LISP code. Unfortunately there is not much documentation on it. But once you figure it out it is VERY self explanatory. The benefits are that you can use all the code options available to VBA\LISP\VLISP all in the same environment. On this note, there is NOTHING that VBA does that I can't program verbatim into LISP code.
>
> If anyone is interested I can always point you toward the free documentation (that you already have) on writing ActiveX code from within LISP.
>
> Edited by: awerning on Jul 13, 2009 1:55 PM
0 Likes