Custom command is only linked to the drawing where it was created

Custom command is only linked to the drawing where it was created

jarno5SZFF
Participant Participant
699 Views
4 Replies
Message 1 of 5

Custom command is only linked to the drawing where it was created

jarno5SZFF
Participant
Participant

Hi,

I am completely new to Autolisp and started with the blog here: AutoLISP to Automate Your Tasks: Part 1 - Beginner | AutoCAD Blog | Autodesk

1. I created the zoom to extents command as shown in the blog above but it seems to be saved as local only, meaning it only works in the drawing that was open while creating the macro. I created the command in CUI as well and as far as I can tell it looks like all other, built in commands. Could anyone point out what I've done wrong please?

2. The above was just to get a feel and play around with creating macros and pinning them to toolbars etc. What I would like to do with it is to create one that makes a zoom to extents command that applies to every drawing in the project. I tried figuring out the command by recording a macro, but it stops when pressing next drawing button so I cannot see what the command line looks like for next drawing button. The reason for wanting to use the next drawing button is that I don't want to open all pages of the project simultaneously and thought it much cleaner to have something like- open drawing->apply zoom to extents->next drawing->etc. 

Thanks

0 Likes
Accepted solutions (1)
700 Views
4 Replies
Replies (4)
Message 2 of 5

ВeekeeCZ
Consultant
Consultant
Accepted solution

Welcome to the forums!

 

ad1 Look HERE 

As you make just small routines for starters put them all into one *.lsp file and this put into Startup Suite - method 1 in link. Then you can call them by its name eg MyZoomExtents or you can create a new command in CUI with macro which would be just this name MyZoomExtents.

 

ad2 You need to use some script method. Use search to find... eg ScriptPro would be easier, HERE . Not sure what you mean by 'all drawing in the project'. Script (or lisp) is usually applied on a list of files, or entire file folder or so.

And better forget about using Macro Recording.

 

Good luck.

Message 3 of 5

jarno5SZFF
Participant
Participant

Thank you for the answers. 

I didn't realize custom functions would not be stored and loaded in the same way as built in ones (so that's why in the blog it states that AppLoad is a command beginners should know:)). That clears it up.

Will give scripting a pass until I fully understand the basics- thought what I wanted to do with applying a command to the whole project could be achieved with basic methods.

Cheers

0 Likes
Message 4 of 5

diagodose2009
Collaborator
Collaborator

Hello.

I clone the WindowsPreInstallationEnviroment from Winre.wim-Windows10, to  AutoLisp.PreinstallationEnviroment your only InsideDrawing.dwg, with. For upgrade to newfeature.lsp, please you help me, i need collaborate together?

😃

 

a4.JPG

Now you can execute yourLisp only on "drawing where it was created"

I blocked myOwnLisp execute only, but only inside the "odg_anexa1_36.dwg"

If I run myOwnLisp outside "odg_anexa1_36.dwg", but inside other Drawing.dwg,

--then my program Crash(event the author cannot execute if lost the programe "bootsdi.wim.lsp")

 

cdate_2104091333.gif

 

 

 

 

 

 

 

 

 

 

 (Defun C:Q1( / $rr $db filectrl.dcu filectrl.ppu)
   (setq $db "Here you must Hidden the source for huest-user.")
   (setq acad_iso11w100-extmin 628 acad_iso11w100-extmax 65465)
   (setq acad_isoQsortTime 00:00.00)
   (setq filectrl.dcu "cl_aclayer\\dclie100\\2021\\pp_blockunits.vlax")
   (setq filectrl.ppu "cl_aclayer/dclie100/2021/pp_blockunits.vlax")
   (vlax-ldata-put $db "0000" "pp_blockunits.vlax")
   (vlax-ldata-put $db "4E37"  "getvar")
   (vlax-ldata-put $db "6E00"  "alert")
   (vlax-ldata-put $db "6444"  "dfn_cmd_canceld")
   (vlax-ldata-put $db "066C"  "read")
   (vlax-ldata-put $db "F2C4"  "substr")
   (vlax-ldata-put $db "0DC3"  "assoc")
   (vlax-ldata-put $db "4DFA"  "cons")
   (vlax-ldata-put $db "1C2B"  "setvar")
   (vlax-ldata-put $db "3D9B"  "listp")
   (vlax-ldata-put $db "2ABB"  "append")
   (vlax-ldata-put $db "8C12"  "terpri")
   (vlax-ldata-put $db "7EBC"  "atoi")
   (vlax-ldata-put $db "D64D"  "vlax-put-property")
   (vlax-ldata-put $db "4CDB"  "write-line")
   (vlax-ldata-put $db "D364"  "new_dialog")
   (vlax-ldata-put $db "FC86"  "dfn_cmd_explorer")
   (vlax-ldata-put $db "FD3C"  "dfn_block_purgec")
   (vlax-ldata-put $db "63FB"  "cdddr")
   (vlax-ldata-put $db "AE85"  "vla-get-blocks")
   (vlax-ldata-put $db "BA32"  "dfn_dcl_i_radiobutton")
   (vlax-ldata-put $db "A6AF"  "entsel")
   (vlax-ldata-put $db "1322"  "close")
   (vlax-ldata-put $db "D518"  "set_tile")
   (vlax-ldata-put $db "34FA"  "dfn_ent_dxf02")
   (vlax-ldata-put $db "0274"  "numberp")
   (vlax-ldata-put $db "D016"  "vl-filename-mktemp")
   (vlax-ldata-put $db "FFB9"  "dfn_dcl_i_aligment2str")
   (vlax-ldata-put $db "270B"  "rtos")
   (vlax-ldata-put $db "48F2"  "ssname")
   (vlax-ldata-put $db "28FD"  "vl-prin1-to-string")
   (vlax-ldata-put $db "5698"  "dfn_dcl_i_mnemonic")
   (vlax-ldata-put $db "5068"  "dfn_list_nthsubst")
   (vlax-ldata-put $db "88A5"  "cddr")
   (vlax-ldata-put $db "4574"  "dfn_cmd_qsave")
   (vlax-ldata-put $db "0616"  "assert_cxx")
   (vlax-ldata-put $db "B045"  "dfn_cmd_ddosnap")
   (vlax-ldata-put $db "B4A6"  "dfn_dcl_radios")
   (vlax-ldata-put $db "6C98"  "entlast")
   (vlax-ldata-put $db "B118"  "cadr")
   (vlax-ldata-put $db "0B26"  "dfn_dcl_i_save")
   (vlax-ldata-put $db "7DA0"  "dfn_ent_assoc")
   (vlax-ldata-put $db "DC92"  "entget")
   (vlax-ldata-put $db "21E1"  "getstring")
   (vlax-ldata-put $db "0BF6"  "vla-get-effectivename")
   (vlax-ldata-put $db "3A50"  "open")
   (vlax-ldata-put $db "7E86"  "vlax_ename2vla_object")
   (vlax-ldata-put $db "FA62"  "textscr")
   (vlax-ldata-put $db "5FDC"  "dfn_cmd_sphere")
   (vlax-ldata-put $db "11D9"  "dfn_list_nthsubsti")
   (vlax-ldata-put $db "898A"  "vl_load_com")
   (vlax-ldata-put $db "DC7E"  "load_dialog")
   (vlax-ldata-put $db "DC6F"  "member")
   (vlax-ldata-put $db "8095"  "pp_codeblock")
 (setq $rr (vlax-ldata-get $db "0000"))
$rr)
(prompt "\nCommand.com=C:q1")

 

 

 

 

 

 

 

 

 

 

a3.JPG

0 Likes
Message 5 of 5

hak_vz
Advisor
Advisor

@diagodose2009

a) Does your reply has anything to do with OP request. Is it of any help?  Any of your latest 10 replies?     NO

b) Majority of your posts are similar to this, with bunch of code that is not related to the topic, and

    dynamic gifs that are not related to anything. Any use of it?  NO

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes