TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: velasquez on August 13, 2009, 07:35:35 PM

Title: Help with vlax-safeArray-fill
Post by: velasquez on August 13, 2009, 07:35:35 PM
Hi
I need help with vlax-safeArray-fill
 
1 - I created a selection group called MySS with ssget. 
2 - I worked this selection group with ssadd and ssdel. 
3 - some entities were modified with the command Trim and the command Extend. 

My problem is: 
How to update the entities of the selection group MySS to create a vlax-safeArray-fill? 

I will work with MySS in -> (vla-add (vla-get-blocks JoyDoc) (vlax-3d-point pt) BlkName)

Thanks
Title: Re: Help with vlax-safeArray-fill
Post by: CAB on August 13, 2009, 09:43:26 PM
Do you really need a safe array?

Could you explain what you are trying to do with the selection set?
Title: Re: Help with vlax-safeArray-fill
Post by: Lee Mac on August 14, 2009, 05:17:01 AM
If you are trying to add the objects to the block definition in VL, I would recommend the vla-copyobjects method, to copy the objects to the block space.

See here:

http://www.theswamp.org/index.php?topic=29637.msg351646#msg351646 (http://www.theswamp.org/index.php?topic=29637.msg351646#msg351646)
Title: Re: Help with vlax-safeArray-fill
Post by: velasquez on August 14, 2009, 08:26:41 AM
The selection group MySS was modified. 
If I try to create a block with VisualLisp -> (JoyAddBlock "TEST1" pt1 MySS T)

I receive the error message below.
; error: lisp value has no coercion to VARIANT with this type:  nil

Code: [Select]
(defun JoyAddBlock (name pt ss flag / JoyDoc ssArray vla_block)
;;;Pega o documento ativo
  (setq JoyDoc (vla-get-activedocument (vlax-get-acad-object)))
  (vla-copyObjects
    JoyDoc
    (setq ssArray (JoySelectionSet->Array ss)) ;_ converte o conjunto de selecao
    (vla-add (vla-get-blocks JoyDoc) (vlax-3d-point pt) name)
  ) ;_ fim de vla-copyObjects
;;;Se o flag for T delete objects
  (if (and flag
   ssArray
   (= (type ssArray) 'safeArray)
;;;is the safeArray made of vlax-object's
   (= (vlax-safeArray-type ssArray) 9)
      ) ;_ fim de and
    (mapcar 'vla-delete (safeArray-value ssArray))
  ) ;_ fim de if
;;;Descarta o objeto
  (vlax-Release-Object JoyDoc)
) ;_ fim de defun