PinkSnail Posted June 27, 2016 Share Posted June 27, 2016 (edited) FIXED IT. CARRY ON! LISP newbie here. I am writing the following code to automatically assign our office's layers to files we receive from a source outside the office. Many of these commands work but I cannot figure out why the code is abruptly stopping without finishing. It is stopping immediately after it makes the layer change from "TaxPropID" to "V-ANNO-PROP-OWNR-E". I have checked the spelling of these two layers and the spelling is correct. I have also checked the spelling on the next layer change from "Centerline" to "V-ANNO-ROAD-E" and it is correct as well. I could use some help determining where I messed up in the code. Thanks The Code: (defun c:RICAIMS v0.1.0 ( / msg) (command "_.chprop" (ssget "_X" '((8 . "Prop_LN"))) "" "_layer" "V-Prop-Line-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "Prop"))) "" "_layer" "V-PROP-LINE-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "SmallDimension"))) "" "_layer" "V-ANNO-DIMS-OTLN-N" "" ) (command "_.chprop" (ssget "_X" '((8 . "AreaCAcre"))) "" "_layer" "V-ANNO-SURV-N" "" ) (command "_.chprop" (ssget "_X" '((8 . "TaxPropID"))) "" "_layer" "V-ANNO-PROP-OWNR-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "Centerline"))) "" "_layer" "V-ANNO-ROAD-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "Plat"))) "" "_layer" "V-PROP-SECT-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "NFHL_X - 1 PCT FUTURE CONDITIO"))) "" "_layer" "V-FLHA-100Y-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "Stream"))) "" "_layer" "V-CREK-CNTR-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "TreeOutline"))) "" "_layer" "V-PLNT-LMTS-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "EarthDam"))) "" "_layer" "V-POND-TOPB-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "Fence"))) "" "_layer" "V-FENCE-AIMS-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "GravelRoad"))) "" "_layer" "V-ROAD-GRVL-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "PLSS"))) "" "_layer" "V-PROP-SECT-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "Thoroughfare"))) "" "_layer" "V-ROAD-ASPH-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "CenterlineAnno"))) "" "_layer" "V-ANNO-TEXT" "" ) (command "_.chprop" (ssget "_X" '((8 . "NFHL_AE - FLOODWAY"))) "" "_layer" "V-FLHA-100Y-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "UtilityPole"))) "" "_layer" "V-POWR-POLE-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "PavedRoad"))) "" "_layer" "V-ROAD-ASPH-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "Culvert"))) "" "_layer" "V-STRM-PIPE-E" "" ) (command "_.chprop" (ssget "_X" '((8 . "NFHL_AE"))) "" "_layer" "V-FLHA-100Y-E" "" ) ) The Command Output: Command: RICAIMS _.chprop Select objects: 228 found Select objects: Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: _layer Enter new layer name <Prop_LN>: V-Prop-Line-E Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: Command: _.chprop Select objects: 24 found Select objects: Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: _layer Enter new layer name <Prop>: V-PROP-LINE-E Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: Command: _.chprop Select objects: 38 found Select objects: Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: _layer Enter new layer name <SmallDimension>: V-ANNO-DIMS-OTLN-N Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: Command: _.chprop Select objects: 5 found Select objects: Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: _layer Enter new layer name <TaxPropID>: V-ANNO-PROP-OWNR-E Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: Command: _.chprop Select objects: 10 found Select objects: Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: _layer Enter new layer name <AreaCAcre>: V-ANNO-SURV-N Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: Command: _.chprop Select objects: 3 found Select objects: Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: _layer Enter new layer name <Centerline>: V-ANNO-ROAD-E Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: Command: _.chprop Select objects: 2 found Select objects: Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: _layer Enter new layer name <PLAT>: V-PROP-SECT-E Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: Command: _.chprop Select objects: Command: RICAIMS Unknown command "RICAIMS". Press F1 for help. Command: _layer Current layer: "V-TOPO-MAJR-E" Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: V-ANNO-PROP-OWNR-E Invalid option keyword. ; error: Function cancelled Edited June 27, 2016 by PinkSnail Quote Link to comment Share on other sites More sharing options...
PinkSnail Posted June 27, 2016 Author Share Posted June 27, 2016 Fixed it. I had a conflicting LISP and it wasn't executing the correct LISP. Newb mistakes, amiright? Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted June 27, 2016 Share Posted June 27, 2016 IMO your code still needs some work. It can only run properly of every call to ssget returns a non-nil result. Most likely this is also the cause of your problem which actually occurs here: Command: _.chprop Select objects: <------------- No selection set. Chprop command ends. Command: RICAIMS <------------- Enter repeats the previous command. Use something like: (if (setq ss (ssget ...)) (command ... ss "" ...) ) Quote Link to comment Share on other sites More sharing options...
David Bethel Posted June 27, 2016 Share Posted June 27, 2016 Maybe something a bit more flexible : [b][color=BLACK]([/color][/b]defun c:chlay [b][color=FUCHSIA]([/color][/b]/ ll ss[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq ll '[b][color=NAVY]([/color][/b][b][color=MAROON]([/color][/b][color=#2f4f4f]"1D-OLD"[/color] [color=#2f4f4f]"1D-NEW"[/color][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b][color=#2f4f4f]"2D-OLD"[/color] [color=#2f4f4f]"2D-NEW"[/color][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b][color=#2f4f4f]"3D-OLD"[/color] [color=#2f4f4f]"3D-NEW"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]foreach l ll [b][color=NAVY]([/color][/b]if [b][color=MAROON]([/color][/b]setq ss [b][color=GREEN]([/color][/b]ssget [color=#2f4f4f]"X"[/color] [b][color=BLUE]([/color][/b]list [b][color=RED]([/color][/b]cons 0 [b][color=PURPLE]([/color][/b]car l[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]progn [b][color=GREEN]([/color][/b]if [b][color=BLUE]([/color][/b]not [b][color=RED]([/color][/b]tblsearch [color=#2f4f4f]"LAYER"[/color] [b][color=PURPLE]([/color][/b]cadr l[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]command [color=#2f4f4f]"_.LAYER"[/color] [color=#2f4f4f]"_New"[/color] [b][color=RED]([/color][/b]cadr l[b][color=RED])[/color][/b] [color=#2f4f4f]""[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]command [color=#2f4f4f]"_.CHPROP"[/color] ss [color=#2f4f4f]""[/color] [color=#2f4f4f]"_LA"[/color] [b][color=BLUE]([/color][/b]cadr l[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] Manipulate the list 'll to your needs. -David Quote Link to comment Share on other sites More sharing options...
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.