Results 1 to 2 of 2

Thread: Hi, help pls, how to extract. with Lisp, the NAME of the file of an XREF, but that is inside another XREF

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2023-07
    Posts
    1
    Login to Give a bone
    0

    Default Hi, help pls, how to extract. with Lisp, the NAME of the file of an XREF, but that is inside another XREF

    Hi, help pls, how to extract. with Lisp, the NAME of the file of an XREF, but that is inside another XREF
    For example, the main XREF, the one displayed on the screen, is called ONE, but within the ONE file, there was already an XREF, within ONE, called TWO.
    I need to extract that Xref name (TWO) to a variable.
    Please.
    And thanks a lot for the help guys !!!!

  2. #2
    Member
    Join Date
    2015-10
    Location
    Alhambra
    Posts
    27
    Login to Give a bone
    0

    Default Re: Hi, help pls, how to extract. with Lisp, the NAME of the file of an XREF, but that is inside another XREF

    try this:
    Code:
    ; GetXrfLst function given name of xref returns list of nested xref names if any
    ; Examples:
    ; (load "GetXrfLst")
    ; (setq lst (GetXrfLst "Xref Name")) ; where "Xref Name" is name of top level Xref in current dwg
    ; Returns:
    ; nil ; if no nested xrefs found
    ; ("Elevator Bank 4" "Stair U") ; sorted list of nested xref names
    ; To get xref path of first element:
    ; (cdr (assoc 2 (tblsearch "BLOCK" (nth 0 lst))))
    ;
    (defun GetXrfLst (xrf / _nestedxrefs lst)
      (vl-load-com)
    ; _nestedxrefs function given tblobjname of block xref name
    ; Returns list of nested xrefs if any
    ; From Lee Mac
    ; http://www.theswamp.org/index.php?topic=55684.0
     (defun _nestedxrefs ( blk / enx rtn xrn )
       (while (setq blk (entnext blk))
           (if (and (setq enx (entget blk))
                    (= "INSERT" (cdr (assoc 0 enx)))
                    (setq xrn (cdr (assoc 2 enx)))
                    (= 4 (logand 4 (cdr (assoc 70 (tblsearch "BLOCK" xrn)))))
                    (not (member xrn rtn))
               )
               (setq rtn (cons xrn rtn))
           )
       )
       rtn
     )
     (if
      (and
       (tblsearch "BLOCK" xrf) ; if xref name exists in block table
       (setq lst (_nestedxrefs (tblobjname "BLOCK" xrf))) ; get nested xrefs
      )
      (vl-sort lst '<) ; return sorted list in ascending order
     )
    ) ; defun

Similar Threads

  1. 2013: Pls Help!!! Pls...Link Dimension not showing up..
    By limruian in forum Revit Architecture - General
    Replies: 0
    Last Post: 2014-03-19, 04:10 AM
  2. Little help with LISP PLS
    By Deyan Dechev in forum AutoLISP
    Replies: 12
    Last Post: 2014-01-29, 04:04 PM
  3. 2014: DWG Nested Inside Detail Comp. > Nested Inside Profile > Nested Inside Window
    By edu.rocha.tavares in forum Revit Architecture - Families
    Replies: 5
    Last Post: 2013-11-26, 06:46 PM
  4. Replies: 4
    Last Post: 2013-11-17, 09:49 PM
  5. extract xref name-path to text file
    By johnccole in forum AutoLISP
    Replies: 4
    Last Post: 2008-01-25, 12:20 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
  •