TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: civil.eng on September 01, 2022, 04:45:04 AM
-
Hello everyone,
I have had a method for copy an object in model space :
(setq newtxtobj (vla-copy txtobj))
(setq bp_txtobj (vlax-get txtobj 'InsertionPoint))
(vla-move newtxtobj(vlax-3d-point bp_owner) (vlax-3d-point pt_owner))
It's been working fine so far , with a project I have to copy a text from model to layout, but the copy of the text is created on the model after using this code while I intend to create it on "Layout1" (although I'm using CTAB to make current the layout) :
(setq obj (vlax-ename->vla-object (car (entsel))))
(setq newobj (vla-copy obj))
(setq bp (vlax-get obj 'InsertionPoint))
(setvar "ctab" "Layout1")
(setq pt (getpoint))
(vla-move newobj
(vlax-3d-point bp)
(vlax-3d-point pt)
)
Could someone tell me what the problem is with the codes ?
Thanks in advance.
-
You can change in which layout an object is using entmake like this:
(cons 410 "LayoutName") ; Target layout name ent
)
)
)
You might also want to have a look at this:
http://www.lee-mac.com/ms2ps.html
-
Thank you for your respond,
Is it also possible to modify insertion point of the text with this method ? (within entmake)
-
Sure, you can modify almost all dxf codes by stacking subst functions:
)
(cons 410 "LayoutName") ; Target layout name (cons 10 '
(10 10 0)) ; InsertionPoint of text ent
)
)
)
)
Edit:
You might find this easier to read. Does the same as above.
)
(setq newent
(subst (cons 410 "LayoutName") (assoc 410 newent
) newent
)) ; Target layout name )
)
-
Can't beat the goat
http://www.lee-mac.com/ms2ps.html
-
Just a guess copy text in model back on its self then use "Chspace" and (entlast). So will work for current layout.
(defun c:chsptxt ( / ent)
(command "mspace")
(setq ent (car (entsel "\n Select txt ")))
(command "chspace" (entlast) "")
(princ)
)
-
Just a guess copy text in model back on its self then use "Chspace" and (entlast). So will work for current layout.
(defun c:chsptxt ( / ent)
(command "mspace")
(setq ent (car (entsel "\n Select txt ")))
(command "chspace" (entlast) "")
(princ)
)
Thank you all guys, my problem has been resolved with your helps and rsponds.