Author Topic: Learning VBA  (Read 14812 times)

0 Members and 1 Guest are viewing this topic.

SomeCallMeDave

  • Guest
Learning VBA
« Reply #30 on: November 03, 2003, 06:13:16 PM »
Oh yea,  you might want to check out the VBA command  split  (it may not be in all versions).

It will handle separating a string based on a delimiting character very nicely.

Code: [Select]

   Dim varTestLine as Variant
    varTestLine = Split(MyLine, "|")

Ben

  • Guest
Learning VBA
« Reply #31 on: November 03, 2003, 09:42:07 PM »
Ahh, you're right there.

Sorry about that.

Actually, I got a little mixed up in my variables there.  Instead of VarCount, it should have been CharCount.

Split would do wonders for this, but that is only in AutoCAD 2000i and above. (It's a VB6 command, and AutoCAD 2000 and lower used VB5)

ReDim is used when you aren't sure of the number of items that will be in an array, and allows you to increment it as needed.  ReDim Preserve is used, because ReDim alone would dump all of the info that was already in the array when it redimensioned it.

Hmmmmm, guess it's been a while since I played with multi dimensional arrays.  Forgot about preserve only working for redim'ing the last portion of the array.

CB_Cal_UK

  • Guest
Re: Learning VBA
« Reply #32 on: November 04, 2003, 05:05:45 AM »
Thanks for starting this thread. This kind of explanation of the code was discussed in another thread and everybody thought it was a great idea.

Just to clarify

Quote from: nivuahc
The menu I'm using is in a folder called

C:\clc\acadmenu

Under this directory I have a folder called DETAILS which contains sub-folders of my details broken into categories.


Does this mean you used to have all your details accessible from a set of drop down menu's within AutoCAD but now you require additional information to be displayed during selection (which isn't possible)

Could you use the content explorer as an easier alternative or do you need to show more information than that also?

Chris

nivuahc

  • Guest
Learning VBA
« Reply #33 on: November 04, 2003, 09:26:56 AM »
Actually my intention is to provide a simple (riiight) tool for my users that would allow them to browse through and select details to insert into Autocad in a simpler fashion than what they do now.

My vision is to have a combobox with the different types of details listed, a listbox with the different details under each type listed and a very large preview window than will allow the user to look at the details quickly and easily to determine if it is the one that they want.

Many of our details are similar. For instance: The detail we have showing a typical receptacle connection is identical to the detail we have showing a typical isolated ground receptacle connection except for, you guessed it, the isolated ground. And looking at a thumbnail of each of those details just doesn't cut it.

Right now, what we do, is flip through a book that has most of our details printed out on 8-1/2 x 11 sheets with the names of the drawings written on the bottom. When they find the detail they want they insert it into Autocad by selecting the drawing name from the appropriate folder. So finding a detail and inserting it into a drawing can take, sometimes, 10 minutes.

I'd like to cut that time down.

So, basically, I'm going for an electronic version of our detail book that can be updated/added to/modified easily.

Ben

  • Guest
Learning VBA
« Reply #34 on: November 05, 2003, 09:06:32 PM »
Actually, CB_Cal hit upon something there.

The Design Center within AutoCAD provides much of what you are looking for.

(Of course you could look at a tool called the LaunchPad, which comes with software similar to what you are looking for, without the folder restrictions.)

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16722
  • Superior Stupidity at its best
Learning VBA
« Reply #35 on: November 22, 2003, 09:48:18 AM »
One of the cool things about a personalized block manager, is that you could also effectively set other parameters that are needed based on your design practices. For example, you could set a scaling parameter for the block that defined how the block should be inserted based on the scale of the drawing. You could also create a lineweight or layer designation to force the blocks to conform to your standards when inserted.

While this is pushing it a bit to the envelope of what we are discussing here, it is admirable that nivuahc wishes to improve upon an existing concept.

If I could offer one point that you might not have thought about. In your drawing preview, rather than simply utilize the acpreview function, why not test to see if the user has voloview installed and use the voloview drawing preview if it is installed, this will give the user the ability to see a much larger and crisper preview of the drawing,  unless I am missing something.

Oh, I guess I owe my first post here to the amiable dent, for informing me that I was the last of a dying breed on the cadalog forum.

Cheers....

K
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Dent Cermak

  • Needs a day job
  • Posts: 6914
  • Clinton, Mississippi
Learning VBA
« Reply #36 on: November 22, 2003, 02:34:54 PM »
GREAT!! Now I get the blame!! Glad to see that you finally made it over Kieth !
If you are looking to me for answers, you really have problems. Carlson Survey 2016 w/ Embedded AutoCad

t-bear

  • Guest
Learning VBA
« Reply #37 on: November 22, 2003, 11:58:27 PM »
It's about time, Keith!   Glad to "see" your smiling face! :lol:

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16722
  • Superior Stupidity at its best
Learning VBA
« Reply #38 on: November 23, 2003, 01:43:30 PM »
:):):):)
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

hendie

  • Guest
Learning VBA
« Reply #39 on: November 24, 2003, 08:44:27 AM »
Quote from: SomeCallMeDave
Oh yea,  you might want to check out the VBA command  split  (it may not be in all versions).

It will handle separating a string based on a delimiting character very nicely.


Kenny has a "SPLIT" function over at http://www.afralisp.com