Results 1 to 2 of 2

Thread: FastSel with an Attribute Copy/Past Command

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2019-06
    Posts
    1
    Login to Give a bone
    0

    Default FastSel with an Attribute Copy/Past Command

    Hi all,

    For context, I am trying to create electrical schematics where attributes of blocks can be copied onto select blocks that are intersecting them (as if they are connected on a schematic). The idea being that I can have a switchboard reference copied onto the circuit breaker connected to it.

    I am trying to run FastSelect and nest in an attribute copy command within it. The problem is, I don't wish for user interaction - FastSelect requires user prompting and I also would like it to cycle through every named block instance so it automatically does it for the entire workspace.

    I am using the following code for cycling through my blocks:

    Code:
    (vl-load-com)
    
    (defun C:SELBLKN ( / e ss objs blk) ; by name
      (setq e (getstring T "\nType block name(s) to select (comma-delimited list or wildcards): ")
            objs (ssadd))
      (if (setq ss (ssget "_X" '((0 . "INSERT"))))
        (progn
          (repeat (setq i (sslength ss))
            (setq name (strcase (vla-get-effectivename (vlax-ename->vla-object (setq blk (ssname ss (setq i (1- i))))))))
            (if (wcmatch name (strcase e))
              (ssadd blk objs)))
        (if (zerop (getvar "CMDACTIVE"))
          (progn (sssetfirst nil objs)
            (princ "Use 'P' for this selection set: ")(princ))
          objs)))
      )
    
    (princ "\nSELBLKN commands loaded.")(princ)
    And the following for copying attributes:

    Code:
    (defun c:CAttribTag ( / att tag str blk a )
    
      (vl-load-com)
    
      (setq att (nentsel "\nPick attribute..."))
      (setq tag (vla-get-tagstring (vlax-ename->vla-object att)))
      (setq str (vla-get-textstring (vlax-ename->vla-object att)))
      (while (setq blk (car (entsel "\nPick block to paste attribute value to - ENTER TO FINISH...")))
        (setq a blk)
        (while (= (cdr (assoc 0 (entget (setq a (entnext a))))) "CABLEREF")
          (if (= (strcase tag) (strcase (vla-get-tagstring (vlax-ename->vla-object a))))
            (vla-put-textstring (vlax-ename->vla-object a) str)
          )
        )
      )
      (princ)
    )
    Understandably it is a hard ask, but is anyone able to assist me with combining these functionalities/able to point me in the right direction for easy fast-select integration?

    Cheers for all of your help

    Hugh

  2. #2
    I could stop if I wanted to
    Join Date
    2005-06
    Location
    CORDOBA-ARGENTINA
    Posts
    275
    Login to Give a bone
    0

    Default Re: FastSel with an Attribute Copy/Past Command

    Please upload the sample.dwg you want to apply it.

Similar Threads

  1. Copy & Past Tables
    By inventor.wishlist1738 in forum Inventor Wish List
    Replies: 1
    Last Post: 2013-11-17, 10:09 PM
  2. Replies: 0
    Last Post: 2011-09-23, 07:21 PM
  3. USE MOVE,COPY,ROTATE,SCALE COMMAND IN ONE COMMAND
    By cadsoft in forum AutoCAD Tips & Tricks
    Replies: 2
    Last Post: 2011-03-14, 02:47 PM
  4. Copy previous Block Attribute Value to next Block Attribute
    By CADfunk MC in forum VBA/COM Interop
    Replies: 8
    Last Post: 2009-02-27, 09:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •