+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
  1. #1
    Full Member
    Computer Details
    Dormant's Computer Details
    Operating System:
    WINDOWS 7 ULTIMATE
    Computer:
    HP Z800 WORKSTATION
    CPU:
    2 x XEON X5650 @ 2.67GHz
    RAM:
    24 GB
    Graphics:
    NVIDIA QUADRO 6000
    Monitor:
    2 x DELL U2711
    Using
    AutoCAD 2013
    Join Date
    Oct 2011
    Posts
    27

    Default Move block based on a attribute in the block

    Registered forum members do not see this ad.

    Hey,

    Is it possible to move blocks based on an attribute inside that block.

    I.e. I have 600 blocks that are correct in the x axis, however i need to move each block to a y-coordinate based on the attribute inside that block.

    Cheers.

  2. #2
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,948

    Default

    Yes.

    Iterate a valid selection set, drilling down into each Object until the desired, nested attribute tag is identified, then extract said attribute's TextString Property, then move the Block Object accordingly.
    "Potential has a shelf life." - Margaret Atwood

  3. #3
    Full Member
    Computer Details
    Dormant's Computer Details
    Operating System:
    WINDOWS 7 ULTIMATE
    Computer:
    HP Z800 WORKSTATION
    CPU:
    2 x XEON X5650 @ 2.67GHz
    RAM:
    24 GB
    Graphics:
    NVIDIA QUADRO 6000
    Monitor:
    2 x DELL U2711
    Using
    AutoCAD 2013
    Join Date
    Oct 2011
    Posts
    27

    Default

    ok, not sure if i explained myself enough, I would like the blocks the move automatically? Not me move one at a time.

  4. #4
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    Quote Originally Posted by Dormant View Post
    ok, not sure if i explained myself enough, I would like the blocks the move automatically? Not me move one at a time.
    Renderman understood what you're trying to say, so he gave you:
    Pseudo code of some sort....
    A starting point...
    Hints....

  5. #5
    Full Member
    Computer Details
    Dormant's Computer Details
    Operating System:
    WINDOWS 7 ULTIMATE
    Computer:
    HP Z800 WORKSTATION
    CPU:
    2 x XEON X5650 @ 2.67GHz
    RAM:
    24 GB
    Graphics:
    NVIDIA QUADRO 6000
    Monitor:
    2 x DELL U2711
    Using
    AutoCAD 2013
    Join Date
    Oct 2011
    Posts
    27

    Default

    ok, sounds complicated

  6. #6
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    Its easy really.. post a screenshot of what it lloks like now and what you want it be after

  7. #7
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    Ok i'm bored.. so here's a sample:
    Code:
    (defun c:PlaceBlockTest ()
           (while
                  (setq pt (getpoint "\nPick Point for test block:"))
      (setq xc (rtos (Car pt) 2 4) yc (rtos (cadr pt) 2 4))
                   (command "_insert"  "coord" pt "" "" xc yc)
                  )
          )
    (defun c:btcrd (/ ss i e)
           (if (setq ss (ssget "_X" '((2 . "coord"))))
     (repeat (setq i (sslength ss))
      (command "_.move" (setq e (ssname ss (setq i (1- i)))) "" "_non"
                           (trans (cdr (assoc 10 (entget e)))  0 1) "_non"
                            (trans (car (list (mapcar '(lambda (j) (distof (vla-get-textstring j))
                                                 ) (vlax-invoke (vlax-ename->vla-object e) 'GetAttributes)))) 0 1)
                          )
                  )
                )
          )
    HTH
    Attached Files

  8. #8
    Full Member
    Computer Details
    Dormant's Computer Details
    Operating System:
    WINDOWS 7 ULTIMATE
    Computer:
    HP Z800 WORKSTATION
    CPU:
    2 x XEON X5650 @ 2.67GHz
    RAM:
    24 GB
    Graphics:
    NVIDIA QUADRO 6000
    Monitor:
    2 x DELL U2711
    Using
    AutoCAD 2013
    Join Date
    Oct 2011
    Posts
    27

    Default

    thanks for your time pBe.

    Thats a nice lsp that i can use for the future labelling eastings and northings.

    The file attached is an example of what im trying to achieve.

    I have 100's of trusses all correct for there x co-ordinate however the y co-ordinate changes all the time, and i have to manually click on each truss and move it accordinaly. I would like to move the truss to the the y co-ordinate based on the attribute value, which i import from a spreadsheet ( which the boss changes all the time).

    cheers, hope u are bored again
    Attached Files

  9. #9
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Lives in Abu Dhabi
    Posts
    2,631

    Default

    Try this Dormant ,and hope it would work for you .

    Code:
    (defun c:TesT
           (/ selectionset intger selectionsetname nextentity entlst p)(vl-load-com)
      ;;; Tharwat 26. Feb. 2012 ;;;
      (if (setq selectionset (ssget "_:L" '((0 . "INSERT") (66 . 1))))
        (repeat (setq intger (sslength selectionset))
          (setq selectionsetname
                 (ssname selectionset (setq intger (1- intger)))
          )
          (setq nextentity (entnext selectionsetname))
          (while
            (not
              (eq (cdr (assoc 0 (setq entlst (entget nextentity))))
                  "SEQEND"
              )
            )
             (if (eq (cdr (assoc 2 entlst)) "RL")
               (vla-move
                 (vlax-ename->vla-object selectionsetname)
                 (vlax-3d-point (setq p (cdr (assoc 10 entlst))))
                 (vlax-3d-point
                   (list (car p) (+ (cadr p) (read (cdr (assoc 1 entlst)))))
                 )
               )
             )
             (setq nextentity (entnext nextentity))
          )
        )
        (princ)
      )
      (princ)
    )
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  10. #10
    Full Member
    Computer Details
    Dormant's Computer Details
    Operating System:
    WINDOWS 7 ULTIMATE
    Computer:
    HP Z800 WORKSTATION
    CPU:
    2 x XEON X5650 @ 2.67GHz
    RAM:
    24 GB
    Graphics:
    NVIDIA QUADRO 6000
    Monitor:
    2 x DELL U2711
    Using
    AutoCAD 2013
    Join Date
    Oct 2011
    Posts
    27

    Default

    Registered forum members do not see this ad.

    many thanks Tharwat, that will work great, i can take the next few days off work

    thanks to pBe for his time also.

    problem solved

Similar Threads

  1. How to move the attribute in a dynamic block when switching the visibility state?
    By MarcoW in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 16
    Last Post: 24th Feb 2010, 08:59 am
  2. How to export Block information and Block Attribute to Excel with VBA?
    By klpocska in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 14th Oct 2009, 11:56 am
  3. Move Align Attribute in a block
    By comcu in forum AutoLISP, Visual LISP & DCL
    Replies: 10
    Last Post: 18th Jul 2008, 11:12 pm
  4. move attribute in a block
    By comcu in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 17th Jul 2008, 10:02 am
  5. Block Attribute answers ability to change block Physical Attributes??
    By Kaidoz in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 19th Mar 2008, 10:25 pm

Bookmarks

Posting Permissions

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