Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/19/2018 in all areas

  1. There are many issues with your current code - you'll need to: Account for null user input for selection of both the source object & destination Check whether the selected source object has a Length property Check whether the selected destination object is an attributed block Account for 32-bit & 64-bit OS & applications when obtaining the ObjectID It's probably easier for you to create a custom program to call my Length Field function.
    1 point
  2. The obvious answer is : You are not passing a block with attributes and/or that you are not passing a dotted pair list of tags and values to the (LM:setattributevalues) function. See Lee's documentation below ;; Set Attribute Values - Lee Mac ;; Sets attributes with tags found in the association list to their associated values. ;; blk - [vla] VLA Block Reference Object ;; lst - [lst] Association list of ((<tag> . <value>) ... ) ;; Returns: nil (defun LM:vl-setattributevalues ( blk lst / itm ) (foreach att (vlax-invoke blk 'getattributes) (if (setq itm (assoc (vla-get-tagstring att) lst)) (vla-put-textstring att (cdr itm)) ) ) )
    1 point
  3. Not sure what you're copying, but if the problem is just pasting to a block (attribute "LEN"), then try this (defun c:ptv (/ reb mrk fm len) (setq fm "%lu2%pr0") (setq reb (vla-get-objectid (vlax-ename->vla-object (car (nentsel "\nSelect the Rebar: "))))) (setq reb (strcat "%<\\AcObjProp Object(%<\\_ObjId "(itoa reb)">%).Length \\f " fm ">%")) (setq len "LEN") (setq reb (list (cons len reb))) ;; These two lines let the client select a subentity (nentsel). ;;(setq mrk (entget (car (nentsel "\nPick the Mark: ")))) ;; This second line then searches for the parent (of the attribute) ;;(setq mrk (vlax-ename->vla-object (cdr (assoc 330 mrk)))) ;; instead this line lets the user select the block itself (entsel) instead of (nentsel) (setq mrk (vlax-ename->vla-object (car (entsel "\nPick the Mark: ")))) (LM:setattributevalues mrk reb) (command "regen") ) ;defun (defun LM:setattributevalues ( blk lst / itm ) (foreach att (vlax-invoke blk 'getattributes) (if (setq itm (assoc (vla-get-tagstring att) lst)) (vla-put-textstring att (cdr itm)) ) ) )
    1 point
×
×
  • Create New...