+ Reply to Thread
Page 2 of 4 FirstFirst 1 2 3 4 LastLast
Results 11 to 20 of 34
  1. #11
    Forum Deity steven-g's Avatar
    Computer Details
    steven-g's Computer Details
    Operating System:
    Win 7
    Discipline
    Construction
    steven-g's Discipline Details
    Occupation
    Draughtsman
    Discipline
    Construction
    Details
    I work in the estimating department of a large building contractor.
    Using
    AutoCAD 2017
    Join Date
    May 2013
    Location
    An Englishman in Belgium
    Posts
    2,055

    Default

    Registered forum members do not see this ad.

    And I can never remeber if it a back slash or forward slash


    PS the edit post button doesn't work either nor the smileys I have to copy and paste them
    I've just been down graded from 2012LT to full Autocad 2017. I WANT LT BACK

  2. #12
    Junior Member
    Computer Details
    JGupte's Computer Details
    Operating System:
    Windows 7
    Discipline
    Construction
    JGupte's Discipline Details
    Occupation
    Document Controller/Report Writer
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Aug 2017
    Location
    Sydney, Australia
    Posts
    15

    Default

    Sorry, I tried but couldn't figure out how to put my code in Code tags.

  3. #13
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,815

    Default

    I have just got used to typing manually put this at start without the space can do via edit no probs some time I type one wrong and have to go back and fix.
    [ c o d e ]
    end is
    [ / c o d e]

    Steven-g nice one about sending commands to Autocad will keep a copy. I knew it could be done.

    You can call lisp from VBA makes an interesting idea.
    ThisDrawing.SendCommand "(load " + Chr(34) + "s:/autodesk/vba/xxxblockedit.lsp" + Chr(34) + ")" + vbCr
    Last edited by BIGAL; 22nd Aug 2017 at 08:09 am.
    A man who never made mistakes never made anything

  4. #14
    Junior Member
    Computer Details
    JGupte's Computer Details
    Operating System:
    Windows 7
    Discipline
    Construction
    JGupte's Discipline Details
    Occupation
    Document Controller/Report Writer
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Aug 2017
    Location
    Sydney, Australia
    Posts
    15

    Default

    Hi BIGAL & steven-g


    I tried steven-g's method, but that requires that I know what the original value of the tag is.
    Steven - is there any way of bypassing the original value requirement ? Maybe a wild card (tried * but that does not work).


    or


    The ATTIN function (in ATTOUT.LSP) would work, but it prompts for an input file. And I don't know LISP, so can't figure out how to modify it.


    BIGAL - can you send me a modified version of ATTOUT.LSP or tell me which line to modify?
    I only need the ATTIN part.


    JG

  5. #15
    Forum Deity steven-g's Avatar
    Computer Details
    steven-g's Computer Details
    Operating System:
    Win 7
    Discipline
    Construction
    steven-g's Discipline Details
    Occupation
    Draughtsman
    Discipline
    Construction
    Details
    I work in the estimating department of a large building contractor.
    Using
    AutoCAD 2017
    Join Date
    May 2013
    Location
    An Englishman in Belgium
    Posts
    2,055

    Default

    The -attedit requires that you know the existing value, and will also allow you to add things like block and tag values so that you can narrow down to the exact block attribute that you want. As opposed to the attin command that has the attribute handle to work with. You stated that you already had used the attout command which means you have the old attribute values there, and if you are working in Excel to keep a record of them then those values must be in Excel.
    If not then it shouldn't be too big of a problem to adapt the code above to use the attin command, the method used to send a command to Autocad from Excel VBA uses the line containing
    Code:
    .ActiveDocument.SendCommand
    I've just been down graded from 2012LT to full Autocad 2017. I WANT LT BACK

  6. #16
    Junior Member
    Computer Details
    JGupte's Computer Details
    Operating System:
    Windows 7
    Discipline
    Construction
    JGupte's Discipline Details
    Occupation
    Document Controller/Report Writer
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Aug 2017
    Location
    Sydney, Australia
    Posts
    15

    Default

    We have over 2000 drawings that need to be updated by this script. So using the ATTOUT command for each would be very tedious.


    I am using the output from the ATTOUT from one drawing (the template that all the others have been created from) to get the block and tag keys. I will then update all drawings with the values specified in my spreadsheet, irrespective of what is there currently.


    The reason for doing this is to apply standard values, something which the draftsmen have not been adhering to thus far.


    I know (thanks to BIGAL) how to send the command to AutoCAD to run my modified ATTIN LSP. But the ATTIN requires a file to be selected, and I want to run this automatically (doubt anyone wants to sit there and select 2000 input files).


    I am trying to modify the ATTIN function with code that BIGAL supplied.


    JU

  7. #17
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,815

    Default

    I have posted a vba block attribute updating code
    You should have looked closer at the VBA that I posted it does not require tag names or Attin, it use attribute creation order works for 99% of time wont go into now. So will work with any block but you must obviously know its name. You dont even have to be in same space/layout as block and it will update. Double click a block and you will see the order.

    If I have 5 attributes and want to update 2nd and 4th attribute something like this will work.

    Code:
    attribs(1).TextString = "Freds plans"
    attribs(3).TextString = "Revision A"
            
    attribs(1).Update
    attribs(3).Update
    A man who never made mistakes never made anything

  8. #18
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO 64-bit
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x64
    CPU:
    Pentium(R) i5 4570 @ 3.2GHz
    RAM:
    8 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    2x ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2011
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    11,795

    Default

    Quote Originally Posted by steven-g View Post
    I have to add here the code posting tags icon doesn't do anything for me, not sure if it's a browser problem (IE) or just broken on the site, but I have to manually type in the CODE tags
    Quote Originally Posted by JGupte View Post
    Sorry, I tried but couldn't figure out how to put my code in Code tags.
    Pretty simple [CODE]Your Code Here[/CODE] =
    Code:
    Your Code Here
    You can type it in manually or use the # which will (maybe) insert the tags.

    Some of the latest browsers seem to have a problem with the WYSIWYG reply box. Go to Settings>General Settings and scroll to Miscellaneous Options then under Message Editor Interface select the bottom Standard Editor.
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  9. #19
    Junior Member
    Computer Details
    JGupte's Computer Details
    Operating System:
    Windows 7
    Discipline
    Construction
    JGupte's Discipline Details
    Occupation
    Document Controller/Report Writer
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Aug 2017
    Location
    Sydney, Australia
    Posts
    15

    Default

    Quote Originally Posted by BIGAL View Post
    You should have looked closer at the VBA that I posted it does not require tag names or Attin, it use attribute creation order works for 99% of time wont go into now. So will work with any block but you must obviously know its name. You dont even have to be in same space/layout as block and it will update. Double click a block and you will see the order.

    Hi BIGAL,


    I did look at your code, and tried to modify it to my requirements, but could not get it to work.


    I have 61 attributes I need to change (if they are not empty), and I tried to loop each one. But nothing happened to my drawing.


    Code:
    Sub Update_DWG() ' Performed in a loop for each drawing (over 2000)
        On Error Resume Next
        Set ACAD = GetObject(, "AutoCAD.Application")
        If Err.Description > vbNullString Then
           Err.Clear
           Set ACAD = CreateObject("AutoCAD.Application")
        End If
        ACAD.Visible = True
        xDWGPath = "C:\Users\297560\Documents\Development\AutoCAD Update\"
        xDWGFile = xDWGNo & ".dwg" '  - set in a calling sub
        xDWGFull = xDWGPath & xDWGFile
        ACAD.Documents.Open (xDWGPath & xDWGFile)
    
    
    
    '
    
        BLOCK_NAME = "SLR_TfNSW_A1_Tblock"
        FilterDXFCode(1) = 2
        FilterDXFVal(1) = "SLR_TfNSW_A1_Tblock"
        SS.Select acSelectionSetAll, , , FilterDXFCode, FilterDXFVal
        For Cntr = 0 To SS.Count - 1
        If SS.Item(Cntr).Name = BLOCK_NAME Then
        If xValue01 <> "" Then
           attribs(1).TextString = xValue01
           attribs(1).Update
        End If
    
    
        ACAD.ActiveDocument.SendCommand "qsave close" & vbCr

  10. #20
    Junior Member
    Computer Details
    JGupte's Computer Details
    Operating System:
    Windows 7
    Discipline
    Construction
    JGupte's Discipline Details
    Occupation
    Document Controller/Report Writer
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Aug 2017
    Location
    Sydney, Australia
    Posts
    15

    Default

    Registered forum members do not see this ad.

    Sorry, posted before I was ready


    Quote Originally Posted by JGupte View Post
    Hi BIGAL,


    I did look at your code, and tried to modify it to my requirements, but could not get it to work.


    I have 61 attributes I need to change (if they are not empty), and I tried to loop each one. But nothing happened to my drawing.


    Code:
    Sub Update_DWG() ' Performed in a loop for each drawing (over 2000)
        On Error Resume Next
        Set ACAD = GetObject(, "AutoCAD.Application")
        If Err.Description > vbNullString Then
           Err.Clear
           Set ACAD = CreateObject("AutoCAD.Application")
        End If
        ACAD.Visible = True
        xDWGPath = "C:\Users\297560\Documents\Development\AutoCAD Update\"
        xDWGFile = xDWGNo & ".dwg" '  - set in a calling sub
        xDWGFull = xDWGPath & xDWGFile
        ACAD.Documents.Open (xDWGPath & xDWGFile)
    
    
    
    ' problem lies here?
    
        BLOCK_NAME = "SLR_TfNSW_A1_Tblock"
        FilterDXFCode(1) = 2
        FilterDXFVal(1) = "SLR_TfNSW_A1_Tblock"
        SS.Select acSelectionSetAll, , , FilterDXFCode, FilterDXFVal
        For Cntr = 0 To SS.Count - 1
        If SS.Item(Cntr).Name = BLOCK_NAME Then
        If xValue01 <> "" Then ' Value01 set in calling sub
           attribs(1).TextString = xValue01
           attribs(1).Update
        End If
    
    'there are 60 more Values I loop through
    
        ACAD.ActiveDocument.SendCommand "qsave close" & vbCr

Similar Threads

  1. Insert a title Block from excel into a opened dwt with excel vba
    By alex140590 in forum .NET, ObjectARX & VBA
    Replies: 2
    Last Post: 15th Jul 2016, 11:43 am
  2. Replies: 9
    Last Post: 19th Apr 2016, 03:43 pm
  3. Title block to excel spreadsheet
    By keiths in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 3rd Dec 2013, 07:26 am
  4. Excel spreadsheet to update autocad drawing title block
    By Jasenc in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 11th Feb 2013, 12:47 pm
  5. EXCEL Drawing register using Autocad Title Block Attributes
    By SimonC in forum AutoLISP, Visual LISP & DCL
    Replies: 8
    Last Post: 25th Aug 2010, 03:40 am

Bookmarks

Posting Permissions

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