See the top rated post in this thread. Click here

Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 32

Thread: Replace the .ctb file at the folder level

  1. #11
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Replace the .ctb file at the folder level

    Here is a repost of the code, with an explanation.

    Public Sub changestylesheets() ' Defining the sub
    Dim oAxDbDoc As New AxDbDocument ' Declare variable
    Dim lst As Variant, dwg As Variant ' Declare variables
    lst = Array("C:\Program Files\Autodesk Civil 3D 2006\Sample\lineweights.dwg",
    "C:\Program Files\Autodesk Civil 3D 2006\Sample\truetype.dwg")
    ' Above is a list of drawings on which to operate
    For Each dwg In lst ' Start of loop through set of drawings
    oAxDbDoc.Open dwg ' This line opens the drawing using ObjectDBX, not the AutoCAD drawing editor.
    Dim item As AcadLayout ' Declare variable
    For Each item In oAxDbDoc.Layouts ' Start of loop through all layouts
    item.StyleSheet = "Fill Patterns.ctb" ' Sets the CTB file name (StyleSheet Property)
    Next item ' End of loop through all layouts
    oAxDbDoc.SaveAs dwg ' Saves the drawing
    Next dwg ' End of loop through all drawings
    End Sub ' End of subroutine.


    One thing I failed to mention, you must add a reference to your VBA project (using Tools | References in the VBAIDE) to "AutoCAD/ObjectDBX Common 16.0 Type Library"
    R.K. McSwain | CAD Panacea |

  2. #12
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Replace the .ctb file at the folder level

    rkmcswain,

    Thanks for the repost of the code, with an explanation.

    I don't know to much about VBA coding and I still wish that I could choose the files from a window that I want to change and not having to list all these drawings in the code.

    Kyle C.

  3. #13
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Replace the .ctb file at the folder level

    Quote Originally Posted by kylec_edg
    I don't know to much about VBA coding and I still wish that I could choose the files from a window that I want to change and not having to list all these drawings in the code.
    You can, you just have to write that portion of the code. That is what I meant in the original post by "build a set of drawings". Sorry, I just don't have time to put together an entire free program for you.

    Since you don't know much about VBA coding, may I suggest you hire out your needs or look for an existing program that will do what you want. Did you check with Dotsoft?

    [disclaimer]
    Please note that I am NOT soliciting work here. [ Moderator Action = ON ] If you have something you would like to say regarding any action taken by a Forum Moderator, please in the first instance contact the Forum Moderator in question, privately via Email or PM ( as clearly stated in the AUGI Forum Guidelines ) and not here in the public forums). [ Moderator Action = OFF ]. [ Poster Action = ON ] Most of the time, the "moderator in question" does not identify him/her self, making your request impossible [ Posted Action = OFF] That is not what I'm saying - I'm just saying rather than you spend any more time trying to put pieces of a free program together that may or may not work - invest in a supported application.
    [/disclaimer]
    Last edited by rkmcswain; 2007-01-30 at 02:35 AM. Reason: Please refer to in-line [ Moderator Action ] comment.
    R.K. McSwain | CAD Panacea |

  4. #14
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Replace the .ctb file at the folder level

    rkmcswain,

    I thank you and all of the AUGI member for all the help with coding that I have asked for in the past and my last comment was not directed to just you but to others that are reading this thread.

    Quote Originally Posted by rkmcswain
    Sorry, I just don't have time to put together an entire free program for you.

    Since you don't know much about VBA coding, may I suggest you hire out your needs or look for an existing program that will do what you want.....
    You also need to remember that a lot of us are not full time coders and/or cadd managers with years of coding knowledge, I for example work for a very small office w/ two cadd drafters, two principals one who knows a little autocad, one who doesn't , myself (a Project Manager 95%, a Cadd Manager 4.5%, and a Coder .5%), and a office method to cad of "get it out the office as soon as possible". The only time I have to learn coding is at lunch, after work, the odd weekend, and the one or two minutes I can look and/or ask questions/help on this web site.

    Being in Southern California I don't have the benefit of going to a local junior college to learn Vlisp or VBA for cad like I have seen in the Midwest & East Coast. all I have seen here is that they teach the Draw toolbar and most of the time nothing about plotting & Xrefing. I know I have one of these at my office.

    Again, I thank you and everyone else that has help me in the past and hopefully will still in the future.

    Kyle C.

  5. #15
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Replace the .ctb file at the folder level

    Quote Originally Posted by kylec_edg
    . . . without opening each one and changing the file one at a time. . .
    Sorry Kyle, but this is not a AutoLISP issue.

    : ) Happy Computing !

    kennet

  6. #16
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Replace the .ctb file at the folder level

    kennet,

    What do you mean? email me a private message if you wish.

    Quote Originally Posted by kennet.sjoberg
    Sorry Kyle, but this is not a AutoLISP issue.
    Kyle C.

  7. #17
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Replace the .ctb file at the folder level

    Quote Originally Posted by kylec_edg
    kennet, What do you mean? . . .
    If AutoLISP you have to open drawing after drawing with a script and do the changes.
    To do it with VBA is out of my power, and this is a AutoLISP thread, but you can try in the VBA thread.

    : ) Happy Computing !

    kennet
    Last edited by kennet.sjoberg; 2006-01-31 at 10:27 PM.

  8. #18
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Replace the .ctb file at the folder level

    Quote Originally Posted by kennet.sjoberg
    If AutoLISP you have to open drawing after drawing with a script and do the changes.
    To do it with VBA is out of my power, and this is a AutoLISP thread, but you can try in the VBA thread.

    : ) Happy Computing !

    kennet
    you are right, this is the lisp forum. I didn't notice that. Sorry, I was just trying to find the easiest method of getting the OP started, and VBA+ObjectDBX was that answer.

    Maybe this should be moved to the VBA stack...
    R.K. McSwain | CAD Panacea |

  9. #19
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Replace the .ctb file at the folder level

    Quote Originally Posted by rkmcswain
    you are right, this is the lisp forum. I didn't notice that. Sorry, I was just trying to find the easiest method of getting the OP started, and VBA+ObjectDBX was that answer.

    Maybe this should be moved to the VBA stack...
    Your code can be converted into ActiveX controls within lisp pretty easily, and then use ObjectDBX with lisp in the same fashion.

  10. #20
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,105
    Login to Give a bone
    0

    Default Re: Replace the .ctb file at the folder level

    Since most of the code provided is in VBA, I have moved this thread to the VBA forum.

    Thanks,

    Richard
    Forum Moderator
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 2015-07-15, 06:38 PM
  2. Replies: 0
    Last Post: 2012-09-20, 04:53 PM
  3. Replies: 0
    Last Post: 2011-05-30, 07:07 AM
  4. copy file folder
    By parkerfeldman in forum AutoLISP
    Replies: 3
    Last Post: 2009-09-02, 04:21 PM
  5. File and Replace text via C#
    By nvphatbk in forum Dot Net API
    Replies: 3
    Last Post: 2008-12-16, 06:23 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
  •