Scan block or Xref?

Discussion in 'AutoCAD' started by Rudy Tovar, Feb 4, 2004.

  1. Rudy Tovar

    Rudy Tovar Guest

    Just playing with the idea, although I'd like to see how far Object.dbx can
    let you scan.

    (defun c:scan (/ e da ty)

    (setq e (entsel"\nSelect block: "))

    (if e
    (progn
    (setq da (entget (car e))
    ty (cdr (assoc 0 da))
    )
    (if (= ty "INSERT")
    (progn
    (setq na (cdr(assoc 2 da)))
    (scan_insert na)
    )
    (progn
    )
    )
    )
    )
    (princ)
    )

    (defun scan_insert ( na / );id ln n y d area cn)

    (vmon)
    (setq id (tblsearch "block" na)
    ln (length id)
    )

    (if (= ln 6)
    (progn
    (setq area (entget(cdr (assoc -2 id)))
    ent (cdr (assoc -1 area))
    cn 0)

    (while
    (and ent
    (setq n (entnext ent))
    )
    ;(pointcollector1 cn)
    (setq d (entget n)
    y (cdr (assoc 0 d))
    )
    (prompt"\n")
    (princ y)
    (princ d)
    (if (= y "INSERT")
    (progn
    (setq x (cdr (assoc 2 d)))
    (scan_insert x)
    )
    )
    (setq ent n cn (1+ cn))

    )
    )
    )
    (princ)
    )
     
    Rudy Tovar, Feb 4, 2004
    #1
  2. Rudy Tovar

    Doug Broad Guest

    HUH? How is what you illustrated using Objectdbx?
     
    Doug Broad, Feb 5, 2004
    #2
  3. Rudy Tovar

    Rudy Tovar Guest

    it's not, I'm just wanting to do the same as illustrated.

    I've not played around with dbx yet, yet.
     
    Rudy Tovar, Feb 5, 2004
    #3
  4. Rudy Tovar

    Doug Broad Guest

    Well, with objectdbx, there is no user interaction so
    to parse blocks you need to use the blocks collection
    (setq blockcollection (vla-get-blocks objectdbxdoc...))
    (vlax-for block blockcollection....

    or
    (vla-item blockcollection "blockname")...

    If you can put what you want to do in english,
    it would be easier to explain.
     
    Doug Broad, Feb 5, 2004
    #4
  5. Rudy Tovar

    Rudy Tovar Guest

    I'll get back to you on what I'm trying to do.

    Goodnight.
     
    Rudy Tovar, Feb 5, 2004
    #5
  6. Rudy Tovar

    John Uhden Guest

    Rudy:

    As Doug pointed out, you've got to convert your style of thinking to ActiveX
    objects, of which a collection is just one type. Objects have applicable
    properties and methods available for getting, putting, adding, copying, and
    deleting. Unfortunately, you'll have to rely one the AutoLisp/DXF crutch in
    certain situations for which we haven't been provided ActiveX methods or
    properties (read any number of threads regarding viewports). Time to move
    forward lest you be left behind.

    (setq Rudy (subst 'vlax-for 'foreach Rudy))
     
    John Uhden, Feb 5, 2004
    #6
  7. Rudy Tovar

    Rudy Tovar Guest

    What does this have to do with what we're talking about?

    I'm on a different page, than what you're thinking about.

    I've been writing since R14 VisualLISP, over 5 years. I'm just now adapting
    to 2000+ methods, that changed R14 Vlisp functions and definitions, although
    I did start 2 years ago.
     
    Rudy Tovar, Feb 5, 2004
    #7
  8. Rudy Tovar

    John Uhden Guest

    I'm sorry, Rudy. Didn't mean to come off as a wise guy. Guess I'm not
    understanding the question.
     
    John Uhden, Feb 6, 2004
    #8
  9. Its getting hot in here, I'm putting my money on Rudy (no offense John)
    Seriously, you guys both have a handle on the activex model, its just that the dbx subject is new to even experienced
    lispers.
    It sounds like what Rudy wants is to be able to get info from an xref.
    It could be any info, but the fact is you cannot access things easily with an xref, such as the dictionary where I save
    a lot of info.
    So what you could do possibly with dbx is open that drawing and use the object model to access what you want.
    This is super slick but I have only played with it with VB. I could do it with lisp though...
    Its a bit wierd though as you are in an invisible drawing. Not a problem if you just want table data though.
    I am guessing it will not be super fast either.
    I got the code from the acad examples I think, its not really hard, the object model is the same as usual.
    I need to do a routine to count app ids for whatever drawings I tell it to. Dbx is cool because it does not have to
    graphically process the drawing in an acad session, so its fast. You need to get up on VB Rudy, if you know activex,
    its the same but the dialogs are organized way better. At least learn ObjectDCL.
    Ok Rudy, don't let me down.


    "Rudy Tovar" <>
    |>What does this have to do with what we're talking about?
    |>
    |>I'm on a different page, than what you're thinking about.
    |>
    |>I've been writing since R14 VisualLISP, over 5 years. I'm just now adapting
    |>to 2000+ methods, that changed R14 Vlisp functions and definitions, although
    |>I did start 2 years ago.
    |>
    |>
    |>|>> Rudy:
    |>>
    |>> As Doug pointed out, you've got to convert your style of thinking to
    |>ActiveX
    |>> objects, of which a collection is just one type. Objects have applicable
    |>> properties and methods available for getting, putting, adding, copying,
    |>and
    |>> deleting. Unfortunately, you'll have to rely one the AutoLisp/DXF crutch
    |>in
    |>> certain situations for which we haven't been provided ActiveX methods or
    |>> properties (read any number of threads regarding viewports). Time to move
    |>> forward lest you be left behind.
    |>>
    |>> (setq Rudy (subst 'vlax-for 'foreach Rudy))
    |>>
    |>> --
    |>> John Uhden, Cadlantic
    |>> <the e-mail address is bogus>
    |>> http://www.cadlantic.com
    |>> Sea Girt, NJ
    |>>
    |>>
    |>> |>> > Just playing with the idea, although I'd like to see how far Object.dbx
    |>can
    |>> > let you scan.
    |>>
    |>

    James Maeding
    Civil Engineer/Programmer
     
    James Maeding, Feb 6, 2004
    #9
  10. Rudy Tovar

    Rudy Tovar Guest

    Thanks James for your confidence.

    I do, and I will do as you've outlined, just the same as I've already
    figured.

    Just the same I'll be getting more and more into .net.

    the dbx subject is new to even experienced
    an xref, such as the dictionary where I save
    object model to access what you want.
    if you just want table data though.
    object model is the same as usual.
    to. Dbx is cool because it does not have to
    to get up on VB Rudy, if you know activex,
     
    Rudy Tovar, Feb 6, 2004
    #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.