Results 1 to 4 of 4

Thread: Add a dws file to cad standards checker

  1. #1
    Member
    Join Date
    2000-10
    Location
    Orlando, Florida
    Posts
    38
    Login to Give a bone
    0

    Default Add a dws file to cad standards checker

    I'd like to automate the process of adding a dws to the Cad Standards Checker (at least), and possibly controlling the settings. Doesn't seem do-able using Autolisp (can't bypass the dialog box). Hoping someone here has a way to do it.

    Thanks

    Mitch Mermel
    CADD Manager
    Matern Profession Engineering
    Maitland, Fl

  2. #2
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Add a dws file to cad standards checker

    You can attach a DWS to a drawing without interaction in Visual LISP.
    Code:
    ;;;Usage (i:AddDWS (findfile "MyStandards.dws"))
    ;;;Michael Puckett
    (defun cdrs  (key lst / pair rtn)
     (while (setq pair (assoc key lst))
      (setq rtn (cons (cdr pair) rtn)
            lst (cdr (member pair lst))))
     (reverse rtn))
    
    ;;;R. Robert Bell
    (defun i:AddDWS  (fileN / dictN eDict xrInt)
     (setq dictN "AcStStandard"
           eDict (cond ((cdr (assoc -1 (dictsearch (namedobjdict) dictN))))
                       ((dictadd (namedobjdict)
                                 dictN
                                 (entmakex '((0 . "DICTIONARY") (100 . "AcDbDictionary")))))))
     (if (setq xrInt (cdrs 3 (entget eDict)))
      (setq xrInt (1+ (apply 'max (mapcar 'atoi xrInt))))
      (setq xrInt 0))
     (dictadd eDict
              (itoa xrInt)
              (entmakex
               (list '(0 . "XRECORD") '(100 . "AcDbXrecord") (cons 1 fileN)))))
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  3. #3
    Member
    Join Date
    2008-10
    Posts
    43
    Login to Give a bone
    0

    Default Re: Add a dws file to cad standards checker

    Although Robert has a good method there, if you're already working in VBA for the rest of your program, there is a way to do it.
    Code:
    Public Sub AttachDWS()
    
    Dim oDict As AcadDictionary, oXRec As AcadXRecord
    Dim XRecordDataType As Variant, XRecordData As Variant
    Dim ArraySize As Long, iCount As Long
    Dim yourDws As String
    Private Const TYPE_STRING = 1
    
    yourDws = "X:\TEST.dws" 'You will want to pass this some other way, obviously.
    
        Set oDict = ThisDrawing.Dictionaries("AcStStandard")
    
    ' Build array from the existing dictionary
    ' because Dict counts from 1, this adds a spot for the new record
        ArraySize = oDict.Count
        Set oXRec = oDict.AddXRecord(ArraySize)
    
        ReDim XRecordDataType(0 To ArraySize) As Integer
        ReDim XRecordData(0 To ArraySize) As Variant
       
    ' append your new data to the XRecord
        XRecordDataType(ArraySize) = TYPE_STRING: XRecordData(ArraySize) = CStr(yourDws)
        oXRec.SetXRecordData XRecordDataType, XRecordData
       
     ' take a look at it
        ThisDrawing.SendCommand "._Standards "
    
    End Sub
    This appends to the existing list of standards files without replacing. It doesn't check for duplicates before attaching the .dws, so you'll want to do that. It's entirely possible someone has a more elegant way of doing this, but I'm not much of a VBA guy myself -- but I thought I'd contribute since I've been getting good advice around here lately.

  4. #4
    Member
    Join Date
    2000-10
    Location
    Orlando, Florida
    Posts
    38
    Login to Give a bone
    0

    Default Re: Add a dws file to cad standards checker

    Thanks, guys. I'm finally getting around to this part of my project.

    Mitch

Similar Threads

  1. CAD Standards Checker - blocks
    By mmccarter in forum CAD Standards
    Replies: 4
    Last Post: 2007-12-13, 08:58 PM
  2. NCS 3.1 (.dws) and standards checker?
    By tedg in forum CAD Standards
    Replies: 8
    Last Post: 2007-09-14, 02:34 PM
  3. Batch Standards Checker
    By jcoe in forum Revit Architecture - General
    Replies: 3
    Last Post: 2006-11-17, 10:53 PM
  4. CAD Standards Checker - not installed?
    By Haden in forum AutoCAD General
    Replies: 3
    Last Post: 2006-07-30, 04:29 AM
  5. BUG in the standards checker?
    By Spectrefish in forum AutoCAD General
    Replies: 0
    Last Post: 2005-06-16, 07:05 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
  •