@sergio_panadero_bautista ,
@sergio_panadero_bautista wrote:
...
These layouts use a title block as an XREF ... I would like to change it so the field is now linked to the sheet number property within the Sheet Set, but it is not updating correctly across different layouts.
You cannot put a sheet-specific field inside the base Xref drawing, it needs to be in each layout.
Create an attribute block (use ATTDEF) at the location desired with insertion at 0,0,0; then use a lisp "InsertSheetNum" to place it on every layout.

(defun c:InsertSheetNum ( / blkName insPt curLayout)
(vl-load-com)
;;; --- CONFIGURATION USER VALUES ---
(setq blkName "SheetNum") ; Name of your sheet info block
(setq insPt '(0.0 0.0 0.0)) ; Change to your exact X, Y, Z coordinates in paper space
;;; ---------------------------------
;; Verify the block exists in the drawing before running
(if (tblsearch "BLOCK" blkName)
(progn
;; Store the active layout name to return to it at the end
(setq curLayout (getvar "CTAB"))
;; Loop through all layouts in the drawing
(foreach lay (layoutlist)
(setvar "CTAB" lay) ; Switch to the layout
;; Verify the block isn't already inserted on this layout to prevent duplicates
(if (not (ssget "X" (list '(0 . "INSERT") (cons 2 blkName) (cons 410 lay))))
(progn
;; Insert the block silently with zero rotation and scale factors of 1
(vl-cmdf "_.-insert" blkName "_non" insPt "1" "1" "0")
(princ (strcat "\nPlaced block on layout: " lay))
)
(princ (strcat "\nBlock already exists on layout: " lay))
)
)
;; Restore original layout view and force a visual update
(setvar "CTAB" curLayout)
(vl-cmdf "_.regenall")
(princ "\n--- Automation Completed Successfully! ---")
)
(alert (strcat "Error: The block \"" blkName "\" was not found in this drawing.\nPlease define or insert it once first."))
)
(princ)
)
Select the "Mark as Solution" if my post solves your issue or answers your question.
Seleccione "Marcar como solución" si mi publicación resuelve o responde a su pregunta.
Emilio Valentin