Idias needed

Discussion in 'AutoCAD' started by alexshein, Feb 27, 2004.

  1. alexshein

    alexshein Guest

    Attention ActiveX experts!
    Here is a piece of my Detail_Block_Search program: "bks" - detail blocks collection from Detail_ Master drawing, "bpf" - detail block name prefix. When it's written this way:

    (vlax-for dt bks
    (if (and (= (vla-get-ObjectName dt) "AcDbBlockTableRecord")
    (wcmatch (strcase (vla-get-name dt)) bpf));and
    (print (vla-get-name dt))
    ))

    it prints each Detail_Block Name once. But if it's written this way:
    (vlax-for dt bks
    (if (and (= (vla-get-ObjectName dt) "AcDbBlockTableRecord")
    (wcmatch (strcase (vla-get-name dt)) bpf));and
    (setq dtn (vla-get-name dt)) (print dtn)
    ))
    it prints each Detail_Block Name several (up to 7) times.

    Any ideas, why?
    Thanks.
     
    alexshein, Feb 27, 2004
    #1
  2. alexshein

    kozmos Guest

    In your codes, the error comes with
    (setq dtn (vla-get-name dt))
    (print dtn)
    if the condition is ok, run (setq dtn (vla-get-name dt))
    or run (print dtn)
    to force it run only once as u want, it should be
    (vlax-for dt bks
    (if (and (= (vla-get-ObjectName dt) "AcDbBlockTableRecord")
    (wcmatch (strcase (vla-get-name dt)) bpf));and
    (progn
    (setq dtn (vla-get-name dt))
    (print dtn)
    )))
     
    kozmos, Feb 28, 2004
    #2
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.