mathieucraveiro Posted January 23, 2013 Posted January 23, 2013 Hello everybody ! I'm new in this website, and unfortunately i'm french, so maybe, i will explain not good, i'm sorry. I have to make a script in autolisp to create layer group or filter i don't know exaclty, for the moment i've just make this bit of scrip : (command "-calque" "e" "ICI-AMGT-URB-Appuis vélo" "CO" "U" "255,53,0" "ICI-AMGT-URB-Appuis vélo" "TL" "CONTINUOUS" "ICI-AMGT-URB-Appuis vélo" "EP" "0.0" "ICI-RES-URB-Appuis vélo" "") (command "-calque" "e" "ICI-RES-URB-Banc simple" "CO" "U" "255,53,0" "ICI-AMGT-URB-Banc simple" "TL" "CONTINUOUS" "ICI-AMGT-URB-Banc simple" "EP" "0.0" "ICI-AMGT-URB-Banc simple" "") (command "-calque" "e" "ICI-AMGT-URB-Corbeille" "CO" "U" "255,53,0" "ICI-AMGT-URB-Corbeille" "TL" "CONTINUOUS" "ICI-AMGT-URB-Corbeille" "EP" "0.0" "ICI-AMGT-URB-Corbeille" "") at the top it's just three layers and i want to create a group to put in these layers, if someone able to help me! Thank you ! Quote
CAD89 Posted January 23, 2013 Posted January 23, 2013 Can you please translate what the command should do because I really do not understand french! I can simply understand if you gave me the translation of the command, I.E.: calque means layer, e means new, the next string would be the layer name, CO would be the color, U should be the true color option, the next one would be the value of the color, tl would be LineType, continuous the value of lt but the rest I can't understand! Please help me so I can help you! Quote
CarlB Posted January 23, 2013 Posted January 23, 2013 (edited) EP must be lineweight, that's the unly option I sese that requires a number. OP didn't really say if any problems with the stuff they posted, but wants to create a layer group or filter. Sounds like a clssroom exercise? A layer filter may be referring to the use of wildcards (filter) to act on a group of layers. Say you want to freeze all layers starting with ICI: (command "-layer" "f" "ICI*" "") Or if they are to simplify the process using a filter: (command "-calque" "e" "ICI-AMGT-URB-Appuis vélo" "e" "ICI-RES-URB-Banc simple" "e" "ICI-AMGT-URB-Corbeille" "CO" "U" "255,53,0" "ICI-*" "TL" "CONTINUOUS" "ICI-*" "EP" "0.0" "ICI-*" "") Edited January 23, 2013 by CarlB typo Quote
Lee Mac Posted January 24, 2013 Posted January 24, 2013 Here is an example of how to create a Layer Filter, if that indeed is what you are trying to do... Quote
mathieucraveiro Posted January 24, 2013 Author Posted January 24, 2013 Hello again and i'm sorry, i forget to translate the command in english, about that , i'm sorry i'm not very good in english, so i hope you will understand. First of all thank you at everybody for your reply. CAD89 you're completly right about "TL" "CO" "e" ... CarlB thank you for your reply also, i'm trying to build a layer group he's name is "wall" with into severals layers but it doesn't work : (defun c:WALL () (command "-calque" "f" "n" "g" "wall" "" "" "wall" "") (command "-calque" "e" "wall1" "e" "wall2" "e" "wall3" "wall4" "e" "wall5" "CO" "U" "255,53,0" "wall*" "TL" "CONTINUOUS" "wall*" "") with: calque: layer, "f" filter, "n" new "g" group My first question is what is "*" because the proprieties doesn't works (color etc..) My second: How make to put my layers into the group layer? Lee Mac: Thank you for you reply but i don't understand not at all this script i begin in autolisp :/ Quote
Lee Mac Posted January 24, 2013 Posted January 24, 2013 Try this mathieu: (defun c:wall ( / i ) (command "_.-layer") (setq i 1) (repeat 5 (command "_M" (strcat "wall" (itoa i))) (setq i (1+ i)) ) (command "_C" "_T" "255,53,0" "wall*" "_L" "Continuous" "wall*" "_filter" "_N" "_G" "" "wall*" "wall" "" ) (princ) ) Bon chance! Quote
mathieucraveiro Posted January 24, 2013 Author Posted January 24, 2013 Thank you Lee Mac it's better but the problem is i don't want to have five layers like that in wall ( wall 1 wall2 wall3 ...) it was an example. how make if i want to create different layers in the same group without use the fonction repeat ? Also i would like to understand somethings what does that means : "*" "i" "itoa" "strcat" "princ" Thank you so much Ps: i love England ! I left the next year but just 1 month at cambridge ! I Would like living over there one day maybe Quote
Lee Mac Posted January 24, 2013 Posted January 24, 2013 Thank you Lee Mac it's better but the problem is i don't want to have five layers like that in wall ( wall 1 wall2 wall3 ...) it was an example. how make if i want to create different layers in the same group without use the fonction repeat ? Consider the following example: (defun c:wall ( / grp lst str ) (setq lst '("Layer1" "Layer2" "Layer3") ;; List of layer names grp "My Group" ;; Group Filter name ) ;; Create Layers (command "_.-layer") (foreach x lst (command "_M" x "_C" "_T" "255,53,0" x "_L" "Continuous" x)) ;; Create Group Filter (setq str (car lst)) (foreach x (cdr lst) (setq str (strcat str "," x))) (command "_filter" "_N" "_G" "" str grp "") (princ) ) I have tried to keep the program simple by using only the -layer command so that you can follow the code; however, if you wanted to add more layer properties you may wish to look into using one of the methods described here. Also i would like to understand somethings what does that means : "*" "i" "itoa" "strcat" "princ" * : a wildcard pattern matching any character sequence (see the documentation on the wcmatch function for more information). i : a local variable holding an integer value that I have used in the code. itoa : an AutoLISP function requiring an integer argument and returning a string representation of the supplied integer. strcat : an AutoLISP function which may be used to concatenate two or more strings. princ : an AutoLISP function to print a message to the command-line or file, or to print a null symbol. In future I would suggest that you refer to the documentation for these functions, which is accessible from the Visual LISP IDE (VLIDE) - I describe how to access this information here. Ps: i love England ! I left the next year but just 1 month at cambridge ! I Would like living over there one day maybe Cambridge is a great place, very picturesque with all of the old architecture, I would love to live there myself Quote
mathieucraveiro Posted January 26, 2013 Author Posted January 26, 2013 thank you for this demonstration and sorry for my late ! Just again what does that means " foreach x lst" And do you tell me how make to learning the autolisp language because that is just the first of my project but i need after a lot of things to build my script. Yes , the problem cambridge is very expensive about the flat :/ Thank you ! Mate ( mathieu in french ) Quote
Lee Mac Posted January 26, 2013 Posted January 26, 2013 You're welcome Mathieu. Just again what does that means " foreach x lst" Please refer to the AutoLISP Developer Documentation as I have indicated above. Lee Quote
mathieucraveiro Posted January 27, 2013 Author Posted January 27, 2013 Thank you very much for these explanations ! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.