Hello guys,
I have the same problem of the topic. I am trying to link callouts blocks with layout pages for years!
I tried ctab and i tried lisp routines without succes.
I really tried to understand the explanations you have given here but I did not get.
First because my English is basic, and second because I'm new in fields and routines.
Anyone of you could send me the block callout with fields ready?
I think that this way I wil understand the explanations finaly.
Thank you very much!
My email: msarqui@gmail.com
Marcelo
Hi,
For my job, i have used this.
I must put a field at the same point for each layout. The 50 layouts have only 1 Viewport.
This can help you?
(defun make_field (obj / pt nw_obj) (setq pt (list 2.15031 103.032 0.0) nw_obj (vla-addMtext Space (vlax-3d-point pt) 0.0 (strcat "{\\fArial|b0|i0|c0|p34;" "%<\\AcVar ctab>%" " - Scale 1/" "%<\\AcExpr (1000/" "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-ObjectID (vlax-ename->vla-object obj))) ">%).CustomScale \\f \"%lu2%qf2816\">%" ") \\f \"%lu2%pr0\">%" ) ) ) (mapcar '(lambda (pr val) (vlax-put nw_obj pr val) ) (list 'AttachmentPoint 'Height 'DrawingDirection 'InsertionPoint 'StyleName 'Layer 'Rotation 'BackgroundFill) (list 1 3.5 5 pt "Standard" "0" 0.0 -1) ) ) (defun c:Field_Layout_Scale ( / AcDoc Space js) (vl-load-com) (foreach n (layoutlist) (setvar "CTAB" n) (setq AcDoc (vla-get-ActiveDocument (vlax-get-acad-object)) Space (vla-get-PaperSpace AcDoc) ) (setq js (ssget "_X" (list '(0 . "VIEWPORT") '(67 . 1) (cons 410 n) ) ) ) (cond (js (make_field (ssname js 0)))) ) (prin1) )
Since Field Expressions can be linked to the majority (if not all) VLA-Objects (even those which are not selectable), and display any available property of such VLA-Objects, the following function should create an MText Field displaying the name of the Layout in which the field is created. The field will consequently update should the Layout name be altered.
;; Layout Field - Lee Mac - 2011 - www.lee-mac.com ;; Creates an MText Field displaying the name of the Layout in which ;; the field is created. (defun c:LayoutField ( / _ObjectID acdoc pt ) (setq acdoc (vla-get-activedocument (vlax-get-acad-object))) (setq _ObjectID (eval (list 'lambda '( obj ) (if (and (vl-string-search "64" (getenv "PROCESSOR_ARCHITECTURE")) (vlax-method-applicable-p (vla-get-utility acdoc) 'getobjectidstring) ) (list 'vla-getobjectidstring (vla-get-utility acdoc) 'obj ':vlax-false) '(itoa (vla-get-objectid obj)) ) ) ) ) (cond ( (/= 1 (getvar 'CVPORT)) (princ "\nCommand not allowed in Modelspace.") ) ( (setq pt (getpoint "\nPoint for MText Field: ")) (vla-addmtext (vla-get-paperspace acdoc) (vlax-3D-point (trans pt 1 0)) 0.0 (strcat "%<\\AcObjProp Object(%<\\_ObjId " (_ObjectID (vla-get-activelayout acdoc)) ">%).Name>%" ) ) ) ) (princ) ) (vl-load-com) (princ)
Thank Lee_Mac you for help but is not working. When I call the command it creates the field, but when I copy this field to another layout, the result is ####.
What am I doing wrong?
Marcelo
Reference the CTAB system variable instead of the active layout's name:
eg.
(defun c:LayoutField (/ point) (cond ((/= (getvar 'CVPORT) 1) (princ "\nCommand not allowed in Modelspace.")) ((setq point (getpoint "\nSpecify placement point for MText field: ")) (vlax-invoke (vla-get-paperspace (vla-get-activedocument (vlax-get-acad-object))) 'addmtext (trans point 1 0) 0. "%<\\AcVar ctab>%" ) ) ) (princ) )
@msarqui wrote:Thank Lee_Mac you for help but is not working. When I call the command it creates the field, but when I copy this field to another layout, the result is ####.
What am I doing wrong?Marcelo
Since the object being referenced is not part of the Field command, you would need to create the field using the program in each layout.
@Lee: Why go though all the trouble of extracting the name from the active layout when the CTAB variable is available and returns the same information?
@alanjt_ wrote:@lee: Why go though all the trouble of extracting the name from the active layout when the CTAB variable is available and returns the same information?
The OP mentioned in a previous post that the CTAB link didn't work for them, so I offered an alternative - but I agree, CTAB is easier.
@Lee_Mac wrote:
@alanjt_ wrote:@lee: Why go though all the trouble of extracting the name from the active layout when the CTAB variable is available and returns the same information?
The OP mentioned in a previous post that the CTAB link didn't work for them, so I offered an alternative - but I agree, CTAB is easier.
Ahh, right on.
Ok friends, I'll try to explain better.
For example: I have two paper space layouts in one file. In "Layout1" I have a drawing with a tag indicating "See detail in Layout2." In "Layout2" I have the detail of the drawing cited in the "Layout1."
The problem is, if for some reason I have to change the name of "Layout2" to "Layout3" I have to go back to the "Layout1" and change my tag to say "See detail in Layout3." Imagine that if I have 50 layouts.
What I would like to have is a FIELD which is connected to the name of the layout in which it was created. So when I copy this FIELD in another layout, it will continue giving the name of the layout that was created. Thus, if for example I change the name of "Layout2" to "Layout3" the FIELD will update automatically.
In my example, I would create this FIELD in "Layout2" to record its name. Then, I copy / paste the FIED in "Layout1." Now, if I change the name of "Layout2", the FIELD in the "Layout1" will actualize automatically.
That's why CTAB does not work for me.
I tried the FIELD "hyperlink" - "view of this drawing" but when I change the name of the layout, the field does not change.
Thanks again
Marcelo
Can't find what you're looking for? Ask the community or share your knowledge.