Author Topic: Block Schedule Creator  (Read 3113 times)

0 Members and 1 Guest are viewing this topic.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Block Schedule Creator
« on: May 01, 2008, 05:05:19 PM »
I am building a block schedule creator that searches all open drawings and creates a schedule of blocks and descriptions, filtered by type.

I have the basic code built, although I have to expand it to allow for schedule naming, text sizing, layers, etc. The goal is to have it 100% user configurable, thus it would be better suited to multiple users in multiple disciplines. I initially considered doing it for my electrical schedules and later decided that it would work for my windows and doors as well.

So, where I am at the moment is I need to determine the bounding box of all blocks and scale them to fit into the space constraints of either a single height space or double height space as determined by the bounding box. (i.e. if the block is going to be scaled to smaller than say 70% to fit in a single height row, make that row a double height. (see attached picture)

I am going to use other symbols for the windows and doors as per our standards, but the ultimately I want the user to be able to choose whether to use the block or an attribute within the block.

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

Find me on https://parler.com @kblackie

Bryco

  • Water Moccasin
  • Posts: 1882
Re: Block Schedule Creator
« Reply #1 on: May 01, 2008, 05:52:00 PM »
Sounds like a pretty cool proggy, Keith.
Looks like a bit of work to make it so versatile.

JohnF

  • Guest
Re: Block Schedule Creator
« Reply #2 on: May 01, 2008, 09:59:44 PM »
Keith,

While you are looping through the drawing you may as well count the number of similar blocks to add to the schedule.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Block Schedule Creator
« Reply #3 on: May 03, 2008, 01:41:37 AM »
Ok .. here is the first incarnation .. limited error checking and the code isn't real pretty .. I havn't had time to organize and optimize ... I may not even bother

It should work on any version of AutoCAD from 2000+ (no TrueColor or ColorBooks in versions where it is not supported)

In the beginning, setting up the schedules will be a pain until you get all of the descriptions entered. (see notes below)

To Do:
Add Block "icon" (geometry) into schedule
Add block count into schedule
Filter existing blocks already designated to a schedule type
Add a "delete schedule template" option
Allow an alternative icon (instead of the block geometry) in the schedule
Add column sorting in block list
Add functionality to open additional drawings to include in schedule
Add mechanism to autoupdate block list when changing schedule type
Needs more error checking

Notes:
Click on item in the block list to add a description
Add descriptions ONLY to the items needed for the particular schedule you are defining as all current blocks will be shown (see filtering item in ToDo list)
If you select additional drawings after clicking the "Get All Blocks" button, you will need to click it once again to update the block list. Similarly, if you change schedule types or create a new schedule, you will need to select the "Get All Blocks" button once again.
When the "Get All Blocks" button changes to "Insert Schedule", you must select it once again to place the schedule in the active drawing.

Operation:
Execute the Macro "MakeSchedule"  ... it should be the only exposed sub in the proggie.

Legal Stuff:
Implements VLAX class Copyright 1999-2001 by Frank Oquendo (see source for full copyright disclosure)
Copyright 2008 ResourceCAD International
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Block Schedule Creator
« Reply #4 on: May 05, 2008, 04:52:58 PM »
FYI .. there is a bug in the GetSchedules function that causes the program to fail when reading the registry to obtain the list of defined schedules. If no schedules exist, a fatal error is generated.

The GetSchedules function needs to be replaced in the modCount module.

Code: [Select]
Public Function GetSchedules() As Variant
    Dim MySettings As Variant, intSettings As Integer
    Dim Dummy(0, 0) As Variant
    MySettings = GetAllSettings("ScheduleCreator", "Schedules")
    On Error GoTo EmptyVar
    If UBound(MySettings, 1) >= 0 Then
        GetSchedules = MySettings
    End If
    GoTo EndSub
EmptyVar:
    GetSchedules = Dummy
EndSub:
End Function

In the calling function (form initialize), replace the For X loop at the end of the function with this:

Code: [Select]
    For X = 0 To UBound(Schedules, 1)
        If Schedules(X, 0) <> "" Then
            Set Lbl(X + 1) = New ScheduleLink
            ReDim Preserve Lbl(0 To (UBound(Lbl) + 1))
            Lbl(X + 1).Caption = Schedules(X, 0)
            Lbl(X + 1).Tag = Schedules(X, 0)
        End If
    Next X

I have added some other functions, just as soon as I get them all ironed out I will post the new code.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

ELOQUINTET

  • Guest
Re: Block Schedule Creator
« Reply #5 on: May 05, 2008, 07:21:32 PM »
Keith,

This looks very interesting. I may have to download it and play around with it but I'm also posting to ask you if you've ever looked at this:

http://www.codezebra.com/livinglegend.html

I was messing with it for awhile and it's pretty sweet. I think you want to write your own but this may also give you some other ideas. Good Luck