Results 1 to 4 of 4

Thread: Scale Change Procedure

  1. #1
    Member
    Join Date
    2002-05
    Posts
    35
    Login to Give a bone
    0

    Default Scale Change Procedure

    AUGIs:

    In ACAD 2002/ADT3.3, I'm trying to create a VBA Project with a procedure (if that's the correct term) written by Bobby C. Jones (that I recevived at least 2 years ago) for automatically changing the ltscale value depending on being in model or paper space. After spending many hours plowing through Richard Binning's VBA Foudnations, I'm still confused about how to enter this procedure (shown below) into a VBA project and get it to work. My problem seems to lie in the naming of the Project or Procedure or Macro (which one I don't understand).

    Can someone give me concise directions on how to set this up?

    Thanks,

    Jim Cronburg
    ____________________________________________________________________

    Private Sub AcadDocument_LayoutSwitched(ByVal LayoutName As String)
    Dim oLayout As AcadLayout

    Set oLayout = ThisDrawing.Layouts.Item(LayoutName)

    If oLayout.ModelType Then
    ThisDrawing.SetVariable "LTSCALE", 48#
    Else
    ThisDrawing.SetVariable "LTSCALE", 1#
    ThisDrawing.SetVariable "PSLTSCALE", 1#
    End If
    End Sub

  2. #2
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    487
    Login to Give a bone
    0

    Default Re: Scale Change Procedure

    The code need to me put ThisDrawing and then it should work

  3. #3
    Member
    Join Date
    2002-05
    Posts
    35
    Login to Give a bone
    0

    Default Re: Scale Change Procedure

    j:

    1) Where precisely should "ThisDrawing" go in the code list?

    2) Do I set this up as a Procedure in a Module?

    3) If so, how do I set up the Name, so that when the Code screen comes up it shows Private Sub [Name].

    4) When I've Run the Procedure, if I've made certain changes, it won't give me a error code. Does this mean it has run properly? How can I tell, because it does not seem to have done anything to the drawing. I've read about "compiling" it but can't find a way to do that. I've also heard about embedding it (in my Template) but how do I know if it is embedded?

    Thanks very much.

    Jim Cronburg

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

    Default Re: Scale Change Procedure

    Jim, here is a step-by-step.

    1. Create a new project (*.dvb).
    • Open VBA Manager, VBAMAN.
    • Click on the "New" button.
    • Click on the project just created and then the "Save As" button.
    • Click on the "Visual Basic Editor" button to switch to the IDE.

    2. Edit the project.
    • Open Project Explorer, ctrl+R .
    • Double click on the ThisDrawing object to open its code pane.
    • Click on the combo box in the upper left where it says "General" and select the AcadDocument object. This creates an event procedure for the objects default procedure, which is BeginSave.
    • Click on the combo box in the upper right that shows the AcadDocument properties/events and select "LayoutSwitched".
    • Paste Bobby's code in this procedure.
    • Save your project. You can change its name in the properties window if you wish.

    What did you do? You created an event handler. It doesn't "do" anything...until its event is triggered, switching layouts. One caveat, you won't be able to change ltscale at the command prompt. You'll have to change this code. For your next lesson, figure how to create a configuration utility for this. You want a command that stores a value for the ltscale. Modify Bobby's code to look at this value instead of hard-coding a scale.
    C:> ED WORKING....

Similar Threads

  1. Replies: 9
    Last Post: 2015-08-21, 06:33 PM
  2. Change LT Scale of all objects
    By Wish List System in forum ACA Wish List
    Replies: 1
    Last Post: 2012-12-08, 07:27 PM
  3. How to Change Linetype Scale to 1
    By BeKirra in forum AutoLISP
    Replies: 4
    Last Post: 2008-10-20, 02:51 AM
  4. Lisp to change Dimstyle scale
    By margaretl in forum AutoLISP
    Replies: 14
    Last Post: 2007-08-02, 08:30 PM
  5. How to change the scale of a jpg file?
    By Joef in forum Revit Architecture - General
    Replies: 15
    Last Post: 2007-05-24, 04:00 AM

Posting Permissions

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