GLAVCVS Posted Saturday at 08:24 PM Posted Saturday at 08:24 PM There are several records in the 'standard' list that contain, for example, the word 'row'. Therefore, when a layer name appears in the drawing with 'row', you must choose 1 of the matches at your discretion. If you replace the 'vlax-for' with the one I attached, you will understand what I am talking about. (vlax-for layer (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)) ) (setq layer-name (vla-get-name layer) layer-name (if (= (substr layer-name 2 1) "-") (substr layer-name 3) layer-name) layer-name (vl-string-subst "*,*" "-" layer-name) layer-name (vl-string-subst "*,*" " " layer-name) ) (if (setq layer-props (assoc (vla-get-name layer) standards)) (setq layer-props (list layer-props)) (foreach x standards (if (wcmatch (car x) (strcat "*" layer-name "*")) (setq layer-props (cons x layer-props)) ) ) ) (if layer-props (progn (if (> (length layer-props) 1) (progn (alert (strcat "There is more than 1 layer record in the \'standard\' list that matches \'" (vla-get-name layer) "\'\nThe layer will be updated to the parameters of the first match in the list")) (setq layer-props (car layer-props)) ) (setq layer-props (car layer-props)) ) (vla-put-color layer (nth 1 layer-props)) (if (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-linetype (list layer (nth 2 layer-props)) ) ) ) (vla-put-linetype layer "Continuous") ) (vla-put-lineweight layer (* (nth 3 layer-props) 100)) (princ (strcat "\nLayer \'" (vla-get-name layer) "\' has been updated to \'standard\' value \'" (car layer-props) "\'")) ) ) (setq layer-props nil) ) Quote
CADChaser Posted 21 hours ago Author Posted 21 hours ago (edited) 16 hours ago, GLAVCVS said: But: how do you know, from the 'standard' list, which is the base name of the layers with which to compare the existing ones in the drawing to decide which ones to modify? For example: in the 'standard' list there are several layer names that begin with 'E-' (E-CENTERLINES, for example) I understand that in these cases I must search for layers whose name matches or contains the string CENTERLINES, BUILDING, CURB....etc) But in the case of layer names that do not begin with 'E-': how do you decide which string to search for? There should be a unified standard for all other layer names in the 'standard' list. I understand the importance of adhering to standard layer naming conventions. However, certain situations may prevent this. Therefore, I propose a feature to allow pattern-based layer name matching. I've also added a "basename" column for all layers, updated and attached below. Edited 19 hours ago by CADChaser Quote
GLAVCVS Posted 20 hours ago Posted 20 hours ago There are 2 'electric' basenames. Also, the 'layer' field now becomes unnecessary. Quote
zulfyy Posted 20 hours ago Posted 20 hours ago 1 minute ago, GLAVCVS said: There are 2 'electric' basenames. Also, the 'layer' field now becomes unnecessary. Yes you are right layer column became useless, we can use base names now and 1 electric basename for all kinda electric named layers, Quote
GLAVCVS Posted 19 hours ago Posted 19 hours ago (edited) Also, for these basenames to work as filters, layer names in drawings would have to contain those basenames separated by spaces, dashes, or any other established punctuation marks. For example, layer names containing 'lot' would have to follow the convention of containing the word 'lot' separately from other longer words: 'E-ROW LOT LINE' but not 'PILOT TUNNEL', for example. If, at some future point, this rule were not followed, the code could produce unexpected results. Edited 19 hours ago by GLAVCVS Quote
GLAVCVS Posted 19 hours ago Posted 19 hours ago Also: you should make sure that there is no layer name that contains more than 1 'basename'. This is something that happens in the drawing you attached. Quote
CADChaser Posted 19 hours ago Author Posted 19 hours ago 29 minutes ago, GLAVCVS said: Also, for these basenames to work as filters, layer names in drawings would have to contain those basenames separated by spaces, dashes, or any other established punctuation marks. For example, layer names containing 'lot' would have to follow the convention of containing the word 'lot' separately from other longer words: 'E-ROW LOT LINE' but not 'PILOT TUNNEL', for example. @GLAVCVS I've tried all layer base names and modified again to match our code criteria, I'm really hoping this will not create issues. I've found few errors in below names and FIXED in attachment. Row filter has 2 layers with *ROW* in it. E-ROW E-ROW LOT LINE lot filter has 2 layers with *LOT* in it. E-Parking Lot E-ROW Lot line Standard layer Properties_02Feb24_Upd.xls Quote
GLAVCVS Posted 17 hours ago Posted 17 hours ago The basename 'electric' keeps being repeated In any case: if you want to be able to create consistent code, you will have to establish a rigid rule for naming layers in drawing. This should be something like: 'basename_' + rest of the name Quote
zulfyy Posted 17 hours ago Posted 17 hours ago 25 minutes ago, GLAVCVS said: The basename 'electric' keeps being repeated In any case: if you want to be able to create consistent code, you will have to establish a rigid rule for naming layers in drawing. This should be something like: 'basename_' + rest of the name Im okay if "electric" filter has multiple results, No problem all electric results could be treated as "E-ELECTRIC" standard. Quote
CADChaser Posted 16 hours ago Author Posted 16 hours ago 1 hour ago, GLAVCVS said: The basename 'electric' keeps being repeated In any case: if you want to be able to create consistent code, you will have to establish a rigid rule for naming layers in drawing. This should be something like: 'basename_' + rest of the name Dear @GLAVCVS, I appreciate your work on this. I'm absolutely fine with the 'ELECTRIC' filter having multiple options, as it should ideally be treated as the standard "E-ELECTRIC." I’ve carefully checked all layer names in CAD basename using the basename filter and have made the necessary modifications in the spreadsheet above. Everything looks good to me, and I’m quite satisfied with the base names. I also hope the code aligns well with these updates. Please do let me know if I’ve missed anything or if further adjustments are needed. Thanks a lot! Quote
SLW210 Posted 14 hours ago Posted 14 hours ago 2 hours ago, zulfyy said: Im okay if "electric" filter has multiple results, No problem all electric results could be treated as "E-ELECTRIC" standard. Are you the same as the original poster? Quote
zulfyy Posted 10 hours ago Posted 10 hours ago 3 hours ago, SLW210 said: Are you the same as the original poster? I'm not the original poster, but... @SLW210 This is my temp account. Could you please review and unrestrict my main account (@Zulfy)Or, could you share an email address so I can request this privately without cluttering this thread? Also, I'm just waiting for the final result because I need a similar routine. 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.