Results 1 to 10 of 10

Thread: New to VBA and need some help

  1. #1
    Active Member
    Join Date
    2006-10
    Posts
    53
    Login to Give a bone
    0

    Wink New to VBA and need some help

    Hi! I am in need to create a block based off of a schedule. Here is what I have to do.
    I need to create a line or pline..whichever.
    1. The user input is Number of spaces.
    2. The distance from edge to first space. (x's 2 one on each end)
    3. Distance between Spaces. (center to center)
    4. The Item type that goes in each space. (In my case a vertical bar with a specific diameter and height which is calculated by the total thickness of the concrete slab minus top and bottom cover, the thickness of my horizontal bar, and 1/8" weld loss.) Which I need to show 2 ways. One is the fabricated height, and the other is the vertical rod's full height (prefab) and diameter.
    5. Then the overall length is calculated by summing it all up.

    I can figure out how to get all the information in there, I just don't know how to visually automate the block.

    Then I need it to visually show these blocks based off a table of multiple entities.
    I will have multiple variation of these blocks within my drawings with a unique name.
    Then once I have them all placed in the drawing, I need to create another program that will create a summary chart that shows all of the line names, with all of the attribute information, and total count of each unique types.

    I'm sure I am just not familiar enough to figure out how to manipulate and create the blocks through programming. Please forgive my Noobness. Any help is appreciated.

  2. #2
    100 Club
    Join Date
    2007-07
    Posts
    104
    Login to Give a bone
    0

    Default Re: New to VBA and need some help

    Hi Irchrismm

    A lot of information is already available if you use google. I did and found this Augi link for you:
    http://forums.augi.com/showthread.ph...ba-programming
    Fixo is often very generous.

    Beside that link, you can find a lot of informationa and sample code from the .NET developer's guide online. .NET is different, but the logic is similar, check:
    http://docs.autodesk.com/ACD/2010/EN...ide/index.html

    Once you get the hang of coding it gets more fun. Easy solutions are great when you're in a hurry, but they don't satisfy as much as a personal victory. Good luck with your developments.

  3. #3
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: New to VBA and need some help

    Hi irchrismm,
    It would be easier to understand what you specifically need, if you attach a picture
    or a simple drawing with explanations,
    I don't have the time to delve into all the details you described,
    Thanks

  4. #4
    Active Member
    Join Date
    2006-10
    Posts
    53
    Login to Give a bone
    0

    Lightbulb Re: New to VBA and need some help

    RAIL LAYOUT.jpg
    Quote Originally Posted by fixo View Post
    Hi irchrismm,
    It would be easier to understand what you specifically need, if you attach a picture
    or a simple drawing with explanations,
    I don't have the time to delve into all the details you described,
    Thanks
    See attached picture of what it is we are building.
    Right now we do almost all of this by hand.

  5. #5
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,586
    Login to Give a bone
    0

    Default Re: New to VBA and need some help

    When you say "visually", do you mean that you want to see the block as you are inserting it? If so, vba can't do this. You need to use a jig .NET.
    C:> ED WORKING....


    LinkedIn

  6. #6
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: New to VBA and need some help

    So the attributes will be have same tags as in your
    table headers?
    Also to make this program quickier, please attach
    the drawing with this picture,
    and what the language you prefer to use VB.NET or VBA?

  7. #7
    Active Member
    Join Date
    2006-10
    Posts
    53
    Login to Give a bone
    0

    Default Re: New to VBA and need some help

    RAIL LAYOUT.pdf

    Attached is an example of what we are doing.
    Currently we can make the chart, but we want to create a block that is the actual length of the manufactured item we are creating. I can do a lot of the elements, but I don't know how to make the bar length vary based off of the chart data. The idea was to work the other way by creating each block via imputs and place them at the proper lenghts and when they were all placed, generate the chart from the blocks.
    Last edited by irchrismm; 2013-07-19 at 02:58 PM.

  8. #8
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: New to VBA and need some help

    Well, I will try convert file to dwg,
    then I will be back, methink not so quickly
    as you wanted be, there is a lot of work

  9. #9
    Active Member
    Join Date
    2006-10
    Posts
    53
    Login to Give a bone
    0

    Default Re: New to VBA and need some help

    A lot of the steps I already have figured out. I just can't get the block to change to the lengths I need them to be other than manually.
    Right now I'm just drawing in PLines with a global thickness and changing the lengths manually. I know how to generate all the attributes within a block, but not actually change individual lengths.

  10. #10
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: New to VBA and need some help

    Show your code you have so far,
    also can you create block manually?
    If so then post your block as drawing to make more sense for me
    Here is quick code just on Lisp, copy to notepad and
    save as .lsp file, and spell all prompts in the code,
    I didn't know how to write them all correct:

    Code:
    (defun C:demo (/ D FIRST H L N NEXT P1 PL1 PL2 PLEFT PR1 PR2 S SO SSET STUD THK W)
      (if (tblsearch "block" "SR01");<~~ block name
        (alert "Already exists")
        (progn
    ;; all sizes from your pdf file for the first item (default input)
    (setq N 8;(getint "\n Number of studs: ")
          D 0.5;(getreal "\nDiameter of stud: ")
          So 2.5;(getreal "\nEdge size: ")
           S 3.0;(getreal "\nEqual space between studs: ")
          H 6.5;(getreal "\nHeight of stud: ")
          W 1.25;(getreal "\nWidth of stud: ")
          Thk 0.25;(getreal "\nThikness of stud: ")
          L (+ (* 2 So)(* (1- N) S)))
    (setq sset (ssadd))
    (setq pleft (getpoint "\nLower left point: "))
    (command "_rectangle" "_non" pleft "_non" (mapcar '+ pleft (list L Thk)))
      (setq first (entlast))
      (ssadd first sset)
    (setq p1 (list (+ (car pleft) So)(+ (cadr pleft) Thk) 0))
    (setq pL1 (mapcar '- p1 (list (/ D 2) 0 0))
           pR1 (mapcar '+ p1 (list (/ D 2) 0 0))
          pL2 (mapcar '+ pL1 (list 0 (- H Thk) 0))
          pR2 (mapcar '+ pR1 (list 0 (- H Thk) 0)))
    (command "_pline" "_non" pL1 "_non" pL2 "_non" pR2 "_non" pR1 "_cl")
    (setq stud (entlast))
    (command "_-array" stud "" "R"  1 N S)
      (while (setq next (entnext first))
        (ssadd next sset)
        (setq first next))
      (command "-block" "SR01" pleft sset "")
    )
        )
    (princ)
    )
      (princ "\n\t---\tType DEMO to execute  \t---")
    (prin1)

Posting Permissions

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