Results 1 to 7 of 7

Thread: Need simple cad program

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2010
    Posts
    80

    Need simple cad program

    I writing a proposal building software for a heating company. I need a free VB6 based simple program to make sketches with that can be integrated into my software. I have tried free cad and it looks like it would work well but I can't get it to work. To technical for me. I'm a bit of a nube. Does anyone know of a good simple open source program.

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Need simple cad program

    Here you have a list with several free choices

    http://en.wikipedia.org/wiki/Compari...ditors_for_CAE
    http://en.wikipedia.org/wiki/Compari...ditors_for_AEC

    EDIT: Or did you mean open source in VB?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2010
    Posts
    80

    Re: Need simple cad program

    Maybe I should redefine my request. I need a cad like program, not a program for cad files. Something simple I can make simple drawings of floor plans and where the heating equipment will go.

  4. #4
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Need simple cad program

    Those are CAD programs, and some are open source/free. If you need one coded in VB, try Planet Source Code.

  5. #5
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Need simple cad program

    Hon

    If those CAD programs that Baja referenced (one, I noticed, is
    written in C++) do not meet your needs (especially if it is to
    also be integrated with the rest of your VB app), perhaps you
    could develop a "simple" one on your own.

    Basically, to generate "sketches", all you'd need would be
    a PictureBox control (your drawing surface). Then, you could
    draw the floor plan using the Line method (alot of them !!).

    Are you interested in building your own VB6 CAD app?

    I'll be glad to give you some pointers along the way (but
    I'm not interested in writing the whole thing for you).

    Spoo

  6. #6

    Thread Starter
    Lively Member
    Join Date
    May 2010
    Posts
    80

    Re: Need simple cad program

    Thank you so much for the offer. I have a very big program that has to be ready for beta testing in two weeks. I'm also a newbe. If it's simple maybe I can do it but i have very little time. FreeCad makes a VB revision that i can use but it has to be installed peace by peace. I have read the web page many times and there is so much terminology I don't understand. Maybe you can turn it into simple lingo for me. From what I see it just needs to be loaded. They say it's very simple. The problem is they put so much BS filler in the instructions. Why can't they just say 1. do this 2 do this 3 do this.

  7. #7
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Need simple cad program

    Hon

    Sorry to hear about your deadline.

    Here is a mock-up of what I had in mind (see image below)
    It involves 2 things
    • a text file named Rooms.txt, and which contains room "dimensions"
    • a form with a CommandButton named cbRooms and a PictureBox named PB1

    Here is what the text file looks like
    Code:
    1,Room,1,0,0,12,8,-3,2,-9,-10
    2,Room,2,0,10,9,2,3,8,-12,-10
    3,Room,3,12,0,20,12,-10,8,-10,-8,-3,-4,3,-8
    4,Room,4,22,12,10,8,-10,-8
    5,HVAC,1,27,3,3,3,-3,-3
    The "fields" (comma separated) are as follows (origin shown in red for clarity)
    • 1 id number
    • 2 room type
    • 3 room number
    • 4 origin-x
    • 5 origin-y
    • 6+ dimension

    .. where origin is always the upper-left corner of the room, and

    .. where dimension is a length. You begin at the room's origin,
    and go clockwise around the room's perimeter, giving each dimension
    to get you back to the origin.
    • right and down are positive
    • left and up are negative


    Here is the code:

    Code:
    ' 1. form load
    Private Sub Form_Load()
        With Me
            .Top = 2000
            .Left = 1000
            .Height = 6000
            .Width = 7000
        End With
    End Sub
    ' 2. button that starts the app
    Private Sub cbRooms_Click()
        With cbRooms
            .Top = 300
            .Left = 300
        End With
        With PB1
            .Cls
            .Top = 800
            .Left = 500
            .Height = 4000
            .Width = 5000
            .Visible = True
            .AutoRedraw = True
        End With
        Dim aRMS(5, 15)    ' main array, fixed dimensions for simplicity
        ' read rooms file
        fn = "c:\VBForum Stuff\Rooms.txt"
        Open fn For Input As #1
        For ii = 1 To 5
            Line Input #1, xtr
            v1 = Split(xtr, ",")
            For jj = 1 To UBound(v1)
                aRMS(ii, jj - 1) = v1(jj)
            Next jj
            If EOF(1) Then
                Exit For
            End If
        Next ii
        Close #1
        ' plot rooms
        For ii = 1 To 5
            rtype = aRMS(ii, 0)
            rnum = aRMS(ii, 1)
            ' set line color
            If rtype = Empty Then
                Exit For
            ElseIf rtype = "Room" Then
                cc = vbBlack
            ElseIf rtype = "HVAC" Then
                cc = vbRed
            End If
            oo = 1000
            fac = 100
            ox = Val(aRMS(ii, 2)) * fac + oo
            oy = Val(aRMS(ii, 3)) * fac + oo
            For jj = 2 To 15
                ' id the origin
                If jj = 2 Then
                    ZDOT ox, oy, 6, cc
                    PB1.CurrentX = ox - 200
                    PB1.CurrentY = oy - 200
                    PB1.Print Trim(ii)
                End If
                ' plot a wall
                nxt = Val(aRMS(ii, jj + 2))
                resu = jj Mod 2
                If resu = 0 Then        ' left/right
                    xx1 = ox
                    xx2 = ox + nxt * fac
                    yy1 = oy
                    yy2 = oy
                    ZLINE xx1, xx2, yy1, yy2, 1, cc
                    ' reset orig
                    ox = xx2
                    oy = yy2
                ElseIf resu = 1 Then    ' up/down
                    xx1 = ox
                    xx2 = ox
                    yy1 = oy
                    yy2 = oy + nxt * fac
                    ZLINE xx1, xx2, yy1, yy2, 1, cc
                    ' reset orig
                    ox = xx2
                    oy = yy2
                End If
                ' exit
                If aRMS(ii, jj + 3) = Empty Then
                    Exit For
                End If
            Next jj
        Next ii
    End Sub
    ' 3. sub to draw a "dot"
    Sub ZDOT(nXX1, nYY1, nDW, nCC)
        With PB1
            .DrawWidth = nDW
            PB1.PSet (nXX1, nYY1), nCC
        End With
    End Sub
    ' 4. sub to draw a line
    Sub ZLINE(nXX1, nXX2, nYY1, nYY2, nDW, nCC)
        With PB1
            .DrawStyle = 0
            .DrawWidth = nDW
            PB1.Line (nXX1, nYY1)-(nXX2, nYY2), nCC
        End With
    End Sub
    The basic steps are
    • read the text file line by line, into v1 (temporary array, holds results of Split function)
    • assign to main array, aRMS()
    • loop through aRMS(), room-by-room, and plot its perimeter (and flag its origin)


    In the image below
    • rooms are shown in black
    • HVAC unit is shown in red

    This app is "crude", but is pretty simple.
    Hope this gives you some ideas.

    Spoo

    .
    Attached Images Attached Images  
    Last edited by Spoo; May 24th, 2010 at 12:32 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width