Path string storage

Discussion in 'AutoCAD' started by Nick_Merchant, Aug 6, 2004.

  1. I don't know any VBA yet. I currently program in VLisp. I figured this should be a "piece of cake" for even a novice VBA programmer.

    I already know I need to learn VBA, so please don't remind me of that shortcoming. Right now I have an immediate problem to solve.

    Another individual wrote a small VBA app' that allows users of my VLisp app' to browse for a folder. When the desired folder is found, selecting "OK" in the dialog returns the path, then stores that string in the attribute of a block in the drawing.

    The sole purpose of the block is to act as a container that the VBA app' can write to and the VLisp app' can read from.

    I wouldn't even be making this post if VLisp allowed users to select folders, but it only allows file selection.

    Now that I'm a little tiny bit smarter, I've learned to use the ( vlax-ldata- ) functions to store and access program-related information that I do not want to send outside of the drawing.

    Can anyone modify this DVB code fragment for me so that the folder name string is sent to a dictionary named "MyDictionary" into a key name "MyKey" that I'll be able to access with ( vlax-ldata-get/read )?

    By the way, I no longer have any desire to use the project data path block, so it could be commented out permanently, as far as I'm concerned.

    Here's the code that I think is the pertinent fragment.

    **********************************************************************

    'Code to send path to Project_Data_Path Block
    Dim PathBlk As AcadBlockReference, Obj As AcadObject, ArAttribs As Variant
    Dim PathAttrib As AcadAttributeReference
    For Each Obj In ThisDrawing.ModelSpace
    If TypeOf Obj Is AcadBlockReference Then
    If StrComp(Obj.Name, "Project_Data_Path", vbTextCompare) = 0 Then
    'MsgBox "found " & Obj.Name
    ArAttribs = Obj.GetAttributes
    For i = LBound(ArAttribs) To UBound(ArAttribs)
    If StrComp("Path", ArAttribs(i).TagString, vbTextCompare) = 0 Then
    ArAttribs(i).TextString = txtPath
    End If
    'MsgBox "For the " & Obj.Name & " Block" & vbCrLf & _
    '"TAG: " & ArAttribs(i).TagString & " VALUE: " & ArAttribs(i).TextString
    Next
    End If
    End If
    Next

    End Sub

    **********************************************************************

    Thanks!
     
    Nick_Merchant, Aug 6, 2004
    #1
  2. GETFILED can select folders but it does so crudely.

    Someone posted a LISP solution for this complete with DCL just this past
    week in the customization group.
     
    Frank Oquendo, Aug 6, 2004
    #2
  3. GETFILED can select folders but it does so crudely.

    It will NOT if there are no files in the folder. You cannot select a folder explicitly. You'd have to select a resident file in the folder, then extract the path afterwards.

    Thanks anyway.
     
    Nick_Merchant, Aug 6, 2004
    #3
  4. Did you even bother to take a look at the solution in the customization
    group?
     
    Frank Oquendo, Aug 6, 2004
    #4
  5. Directory select with only lisp
    T.Willey
    Tuesday, August 03, 2004 12:51 PM
     
    Frank Oquendo, Aug 6, 2004
    #5
  6. Nick_Merchant

    Jeff Mishler Guest

    See the post by Tony T in that same thread....will solve your problem

    --
    Jeff
    check out www.cadvault.com
    it into my app' just yet. I can see how it works though just by skimming
    over it.
    frustrated than I was that Autodesk apparently overlooked that necessary
    functionality, so he came up with a roundabout way of acquiring the folder
    names without using an Explorer-type browser.
    point that what you said was not accurate, because Visual Lisp does not
    allow you to browse for a folder, only for a file.
     
    Jeff Mishler, Aug 6, 2004
    #6
  7. Jeff... T H A N K Y O U ! ! !

    That was EXACTLY what I was looking for. Now I can throw the dvb away completely.

    This website and the some of the professionals that post here are just God-sends for dummies like me who need to be lead by the nose!

    If I knew VBA, I would've probably been able to figure out what object names to use, properties to get and methods to invoke to get what I wanted all on my own.

    Time to go buy a VBA book. You got any good references for somebody who uses VLAX, but has never even looked at VBA? I had experience with Basic, Fortran, Cobol and a little Assembler, but I've been using Lisp for the past 10 years and VLisp heavily for the past 2 years.
     
    Nick_Merchant, Aug 7, 2004
    #7
  8. Nick_Merchant

    Jeff Mishler Guest

    You're Welcome Nick. Although it was Tony that gave you what you needed...
    ;-)

    I have gotten into VBA somewhat (enough to write some productive routines
    for myself) but have a lot yet to learn. Your knowledge of other languages
    beats me by a mile. I had only used Basic( a Looong time ago), lisp and then
    Vlisp prior to my tackling VBA. IMHO, if you have a grasp of the vlax-
    functions then VBA is really not too hard to pick up. I think the hardest
    part for me was having to declare all of the variables before they can be
    used.

    If you really are interested in learning some more, at your own pace, you
    may want to check this out:
    http://www.cadvault.com/forums/showthread.php?t=9908

    Good Luck!

    --
    Jeff
    check out www.cadvault.com

    God-sends for dummies like me who need to be lead by the nose!
    names to use, properties to get and methods to invoke to get what I wanted
    all on my own.
    uses VLAX, but has never even looked at VBA? I had experience with Basic,
    Fortran, Cobol and a little Assembler, but I've been using Lisp for the past
    10 years and VLisp heavily for the past 2 years.
     
    Jeff Mishler, Aug 7, 2004
    #8
  9. Just go to your local library and sign out VBA for Dummies. That'll get you
    into VBA and save you a few bucks that you can then spend on a good AutoCAD
    VBA reference book like Joe Sutphin's.

    And Jeff is correct - VLisp knowledge will get you close because its
    nothing more than a lisp 'wrapper' or 'connection' around vba.

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Aug 7, 2004
    #9
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.