Saving project info in the DWG

Discussion in 'AutoCAD' started by Yves, Jan 14, 2005.

  1. Yves

    Yves Guest

    Hi,

    I'm looking for an easy way to save a project number inside a drawing, I
    know a block with attributs would do the job, but is there a place I could
    save info on a project that I could read on an opened drawing.

    I only need to save a number, so I could set folders to look at.

    Thanks.
     
    Yves, Jan 14, 2005
    #1
  2. Hi,

    In AutoCAD 2005 you can use fields.

    In earlier versions you can use Xdata attached to something permanent such
    as Layer 0.

    --

    Regards,


    Laurie Comerford
    www.cadapps.com.au
     
    Laurie Comerford, Jan 14, 2005
    #2
  3. You can also just create a Dictionary and add an Xrecord to it. Let me know
    if you need more specifics.


    Dale
     
    Dale Levesque, Jan 15, 2005
    #3
  4. Yves

    John Coon Guest

    Yves,

    A simple way could be the drawing properties.
    File>drawing properties>
    It comes up with a dialog box that you can enter data into for your drawing
    or project. I bet you can access that in vba for use in another programs.
    I remember seeing some posts in the ng about that but I have not tried it.

    One nice thing about the drawing properties is that you can view that
    information in your windows explorer. In my mind a added plus when searching
    for
    archived drawings.

    John Coon
     
    John Coon, Jan 15, 2005
    #4
  5. Use a custom drawing property (DWGPROPS command, Custom tab),
    to store the project number. You can then use either fields, or a
    RTEXT DIESEL expression to display the value in text in the drawing.
     
    Tony Tanzillo, Jan 15, 2005
    #5
  6. i use the projectname variable, then have a standards folder under the
    projectname where i keep all the project info in a text file
     
    Mark Dubbelaar, Jan 17, 2005
    #6
  7. Yves

    ClementZheng Guest

    Could you please tell me how can I access such a custom drawing property by VBA?
     
    ClementZheng, Jan 17, 2005
    #7
  8. Yves

    Kevin Terry Guest

    This works for 2002 and earlier. If you have 2004 or later let me know, i
    have different routines.

    Note you may need to modify this a little to get it to work for you.

    'Set custom drawing property
    '
    Public Function TestSetDrawingProperty() As String

    Const DICTIONARY_NAME = "DWGPROPS"

    Dim DwgInfo As AcadXRecord
    Dim DataType As Variant
    Dim Data As Variant
    Dim i As Long
    Dim sType As String, sValue As String
    Dim iType As Integer
    Dim vProp As Variant

    'Title = 0
    'Subject = 1
    'Author = 2
    'Comments = 3
    'Keywords = 4

    On Error GoTo HandleError
    Set DwgInfo = ThisDrawing.Dictionaries(DICTIONARY_NAME)

    DwgInfo.GetXRecordData DataType, Data

    'change title:
    sValue = "Kevin"
    iType = 1
    Data(iType) = sValue
    DwgInfo.SetXRecordData DataType, Data

    'change a custom field (assumes there is a custom field called NAME):
    sType = "NAME"
    sValue = "Kevin"
    For i = LBound(Data) To UBound(Data)
    If DataType(i) >= 300 And DataType(i) <= 309 Then
    If Left(CStr(Data(i)), Len(sType)) = sType Then
    vProp = sType & "=" & sValue
    Data(i) = vProp
    DwgInfo.SetXRecordData DataType, Data
    Exit For
    End If
    End If
    Next

    'look at all of them:
    For i = LBound(Data) To UBound(Data)
    Debug.Print Data(i)
    Next

    Exit Function

    HandleError:

    Set DwgInfo = Nothing

    End Function


    Kevin

    by VBA?
     
    Kevin Terry, Jan 17, 2005
    #8
  9. Yves

    Yves Guest

    Hi,

    Thanks,

    It looks as it were extended data.
     
    Yves, Jan 17, 2005
    #9
  10. Yves

    ClementZheng Guest

    Thank you.
    I'm using 2002 now.
     
    ClementZheng, Jan 17, 2005
    #10
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.