Jump to content

Recommended Posts

Posted (edited)

Hi, I have field in the table cell (gets value from one block's attribute) and I want to move or copy this to another cell or table, but CTRL+C and CTRL+V do not function. Inserted content (field) is than corrupted - object not found ####.... How to do this?

Edited by VAC
Posted

I can't find a simple way to do what you're asking. However, I did find a way to copy fields.

 

When you edit a field in the Field window, you'll see an expression in the bottom pane that defines the field. It begins and ends with percent (%) characters. Select that expression and copy it to the clipboard. You can then paste that expression into a text object. I tried it, and it works!

Posted (edited)

Thank you, I know this way but it is tedious and slow and I need to do many shifts. I don't understand why it doesn't work in the normal expected way (copy&paste).....

Edited by VAC
Posted (edited)

I did this script (CopyFieldBetweenCells) - works fine

(defun c:cfbc () ; VAC
  (setq obj (vlax-ename->vla-object (car (entsel "Pick table object"))))
  (while t
    (setq ans (vla-fieldcode (vlax-ename->vla-object (car (nentsel "Select Cell to Copy Field/Text: ")))))
    (setq ins (getpoint "\nSelect Cell to Insert Field/Text: "))
    (setq ans1 (LM:Hittest ins (setq Tables (Getacadtableobjects))))
    (vla-settext obj (nth 1 ans1) (nth 2 ans1) ans)  
  )
)

(Defun LM:Hittest ( Pt Lst ) ; Lee Mac
      (If (And (Vl-consp Pt) (Vl-every 'Numberp Pt))
        (Vl-some
          (Function
            (Lambda ( O / R C )
              (If (Eq :Vlax-true (Vla-hittest O (Vlax-3d-point (Trans Pt 1 0)) (Vlax-3d-point (Trans (Getvar 'Viewdir) 1 0)) 'R 'C)) (List O R C) )
            )
          )
          Lst
        )
      )
)

(defun LM:getattributevalues ( blk / enx ) ; Lee Mac
    (if (and (setq blk (entnext blk)) (= "ATTRIB" (cdr (assoc 0 (setq enx (entget blk))))))
        (cons
            (cons
                (cdr (assoc 2 enx))
                (cdr (assoc 1 (reverse enx)))
            )
            (LM:getattributevalues blk)
        )
    )
)

 

Edited by VAC

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...