+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
  1. #1
    Full Member
    Using
    MEP 2010
    Join Date
    Oct 2009
    Posts
    77

    Default Determine what associative dimensions are attached to.

    Registered forum members do not see this ad.

    Is there anyway to determine what each end of a dimension is attached to when you are using associative dimensions?

    What I am trying to determine is the dimension attached to a xref or an inserted block on each end?

  2. #2
    Senior Member
    Computer Details
    JohnM's Computer Details
    Operating System:
    xp pro
    Using
    AutoCAD 2006
    Join Date
    Feb 2009
    Location
    houston, texas
    Posts
    382

    Default

    give this a try

    Code:
     
    (defun c:asdm (/ ss ssm ent obj1 obj2 lbl1 lbl2 tsr)
     (while (not(setq ss (ssget "_:S" '((0 . "Dimension")(102 . "{ACAD_REACTORS"))))))
       (if ss
     (progn
     (setq ssnm (ssname ss 0))
     (setq ent(entget(cdr (assoc 330(entget ssnm)))))
     (setq obj1 (entget(cdr(assoc -1(entget(cdr(assoc  331 ent)))))))
       (setq obj2 (entget(cdr(assoc -1(entget(entnext(cdr(assoc  331 ent)))))))) 
       (setq lbl1 (cdr(assoc 0 obj1)))
       (setq lbl2 (cdr(assoc 0 obj2)))
       (if (=(cdr(assoc 0 obj1))"INSERT")
     (progn
     (setq tsr(tblsearch "block" (cdr(assoc 2 obj1))))
     (if (=(cdr(assoc 70 tsr)) 0)(setq lbl1 "Block")(setq lbl1 "XREF"))
     );_progn
     );_if
     (if (=(cdr(assoc 0 obj2))"INSERT")
     (progn
     (setq tsr(tblsearch "block" (cdr(assoc 2 obj2))))
     (if (=(cdr(assoc 70 tsr)) 0)(setq lbl2 "Block")(setq lbl2 "XREF"))
     );_progn
     );_if
     (alert (strcat "First Attachment to "lbl1 "\n" "Second Attachment to "lbl2))
     );_progn
     );_if
       (princ)
      );_defun

  3. #3
    Full Member
    Using
    MEP 2010
    Join Date
    Oct 2009
    Posts
    77

    Default

    Thank you for your help. It is listing my xref as a block.

    Nevermind, I tried a another dwg and it is working fine, there was something wrong with that dwg. Thx.

  4. #4
    Full Member
    Using
    MEP 2010
    Join Date
    Oct 2009
    Posts
    77

    Default

    Well I spoke to soon, I don't seem to be able to get consistant results. Must be how I am doing the dimensions. One time I get a xref, the next a block. I am doing a dim align and select the insert of the block and then perpendicular to the wall and it is giving me two blocks.

  5. #5
    Full Member
    Using
    MEP 2010
    Join Date
    Oct 2009
    Posts
    77

    Default

    I have tried all sorts of iterations, but this routine works once in a while and far between. Not sure why as the code looks correct. Some times it just returns the same block on one end of the dimension.

  6. #6
    Full Member
    Using
    MEP 2010
    Join Date
    Oct 2009
    Posts
    77

    Default

    It appears that the Entnext function is getting the next entity that is in the data base and not the next reactor in the list. Here is the ent variable

    Code:
    ((-1 . <Entity name: 7ffff7fc620>) (0 . "DIMASSOC") (5 . "59D3A") (102 . 
    "{ACAD_REACTORS") (330 . <Entity name: 7ffff7fc580>) (102 . "}") (330 . <Entity 
    name: 7ffff7fc580>) (100 . "AcDbDimAssoc") (330 . <Entity name: 7ffff7fc4b0>) 
    (90 . 3) (70 . 0) (71 . 0) (1 . "AcDbOsnapPointRef") (72 . 10) (331 . <Entity 
    name: 7ffffc3d470>) (73 . 2) (91 . 0) (40 . 0.319045) (10 0.0 0.0 0.0) (75 . 0) 
    (1 . "AcDbOsnapPointRef") (72 . 7) (331 . <Entity name: 7ffffc39c20>) (73 . 2) 
    (91 . 0) (40 . 0.0) (10 0.0 0.0 0.0) (75 . 0))
    There are three entities there but is getting one and not the next.

    How do I parse thru this since there are two 330 codes?

  7. #7
    Senior Member
    Computer Details
    JohnM's Computer Details
    Operating System:
    xp pro
    Using
    AutoCAD 2006
    Join Date
    Feb 2009
    Location
    houston, texas
    Posts
    382

    Default

    I just threw it together and did not do a lot of experimenting with it. I’ll play around when I get a chance and see about fixing it.

  8. #8
    Full Member
    Using
    MEP 2010
    Join Date
    Oct 2009
    Posts
    77

    Default

    Quote Originally Posted by JohnM View Post
    I just threw it together and did not do a lot of experimenting with it. I’ll play around when I get a chance and see about fixing it.
    I appreciate the help. I can see the correct entities listed there, just cant get at them.

  9. #9
    Senior Member
    Computer Details
    JohnM's Computer Details
    Operating System:
    xp pro
    Using
    AutoCAD 2006
    Join Date
    Feb 2009
    Location
    houston, texas
    Posts
    382

    Default

    The entity returned is a list. You can use the (foreach) function to parse through the list testing each item in the list to meet you criteria. This is also one way to return polyline vertices since there are multiple DXF code with the same number.
    Example:
    (Setq lst1 '());_set up a blank list
    (foreach item ent
    (if (= (car item) 330)(setq lst1 (cons (cdr item) lst1)))
    );_foreach

    This will make a list of all 330 items then you can access each item in the list and perform what ever you need to.

  10. #10
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,199

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by manddarran View Post
    How do I parse thru this since there are two 330 codes?
    Code:
    (vl-remove-if-not
      (function (lambda (x) (eq 330 (car x))))
      EntLst)
    DropBox
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

Similar Threads

  1. Associative dimensions
    By DP-MWS in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 4
    Last Post: 8th Jan 2010, 02:34 pm
  2. Is it possible to create associative, PaperSpace dimensions using VBA
    By ginak in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 10th Jul 2009, 09:32 pm
  3. Replies: 1
    Last Post: 19th Apr 2009, 02:05 pm
  4. Need ideas... rotating associative dimensions
    By frostrap in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 9th Feb 2008, 01:02 am
  5. associative dimensions in x-refs
    By michaeloureiro in forum AutoCAD Drawing Management & Output
    Replies: 7
    Last Post: 10th Jan 2008, 04:06 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