Make blcok with VL

Discussion in 'AutoCAD' started by BillZ, Aug 5, 2004.

  1. BillZ

    BillZ Guest

    R2005:

    Can someone help me with this code?

    Command: (setq blkobj (vla-add (vla-get-blocks (vla-get-activedocument
    (vlax-get-acad-object))) (vlax-3d-point r1p1) "testblock"))
    #<VLA-OBJECT IAcadBlock2 0d32eae4>

    Command: (setq sary (vlax-safearray-fill (vlax-make-safearray vlax-vbObject '(0
    0)) blkobj))
    ; error: vlax-safearray-fill failed. Invalid initialization list.
    #<safearray...> #<VLA-OBJECT IAcadBlock2 0d32eae4>

    I've checked it over and cannot get it to work.

    TIA

    Bill
     
    BillZ, Aug 5, 2004
    #1
  2. BillZ

    BillZ Guest

    I posted wrong:

    Command: (setq sary (vlax-safearray-fill (vlax-make-safearray vlax-vbObject '(0
    0)) obj1))
    ; error: vlax-safearray-fill failed. Invalid initialization list.
    #<safearray...> #<VLA-OBJECT IAcadBlock2 0d32eae4>

    With obj1 being the vla polyline object.

    Thanks
    Bill
     
    BillZ, Aug 5, 2004
    #2
  3. I reiterate: What is your intention with that line of code?


    --
    R. Robert Bell


    I posted wrong:

    Command: (setq sary (vlax-safearray-fill (vlax-make-safearray vlax-vbObject
    '(0
    0)) obj1))
    ; error: vlax-safearray-fill failed. Invalid initialization list.
    #<safearray...> #<VLA-OBJECT IAcadBlock2 0d32eae4>

    With obj1 being the vla polyline object.

    Thanks
    Bill
     
    R. Robert Bell, Aug 5, 2004
    #3
  4. BillZ

    BillZ Guest

    reiterate: What is your intention with that line of code?<<<

    sorry, slow to sink in today.

    I'm trying to add an object to a block definition.

    Bill
     
    BillZ, Aug 5, 2004
    #4
  5. BillZ

    John Uhden Guest

    This abridged excerpt may help a little:
    (and
    (setq ss (ssget))
    ;; need to do some filtering here, like for xrefs and viewports
    (> (setq sslen (sslength ss)) 0)
    (or
    ;; p is the block's insbase
    ;; You'd better check for the existence of <BlockName> first!
    (setq Block (vla-add Blocks (vlax-3d-point p) <BlockName>))
    (prompt "\nUnable to make block.")
    )
    (princ "\n")
    (setq i 0)
    (repeat (sslength ss)
    (prompt (strcat "\rProcessing # " (itoa (1+ i)) "/" (itoa sslen)))
    (princ)
    (setq Objects (cons (vlax-ename->vla-object (ssname ss i)) Objects)
    i (1+ i)
    )
    )
    (setq Array
    (vlax-make-safearray vlax-vbObject (cons 0 (1- (length Objects))))
    )
    (vlax-safearray-fill Array Objects)
    (or
    (not
    (vl-catch-all-error-p
    (setq Error
    (vl-catch-all-apply
    'vla-copyobjects
    (list Doc Array Block 'IDpairs)
    )
    )
    )
    )
    (prompt "\nUnable to add objects to block definition.")
    )
    )
     
    John Uhden, Aug 7, 2004
    #5
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.