kam1967 Posted March 1, 2011 Share Posted March 1, 2011 Hi guys, I'm stumped. I cannot find a way to get the X option to work. The error I get when I tried to specify a linetype in a layer creation is this: Enter lineweight (0.0mm - 2.11mm): ERROR: bad argument type: numberp: "0.13" (defun C:LAX ()(setq PickItem (car (entsel "\nPick object for new layer: "))) (setq Entdata (entget pickItem)) (setq ObjLayer (cdr (assoc 8 EntData))) (setq ObjType (cdr (assoc 0 EntData))) (princ (strcat ObjLayer " is layer name of " ObjType " selected")) (setq Lyrdata (tblsearch "LAYER" ObjLayer)) (setq LyrLtype (cdr (assoc 6 Lyrdata))) (setq LyrColor (cdr (assoc 62 Lyrdata))) (setqLyrEdata (entget (tblobjname "Layer" ObjLayer))LyrWeight (cdr (assoc 370 LyrEdata)))(initget "N D V X")(setq LyrSuffix (getkword "\nEnter suffix type [N/D/V/X]:"))(cond ((= LyrSuffix "N") (setq NewLyrName (strcat ObjLayer "-N-PKG-1")) ) ((= LyrSuffix "D") (setq NewLyrName (strcat ObjLayer "-D-PKG-1")) ) ((= LyrSuffix "V") (setq NewLyrName (strcat ObjLayer "-V-PKG-1")) ) ((= LyrSuffix "X") (setq NewLyrName (strcat ObjLayer "-X-PKG-1")) (setq LyrLtype "PHANTOM") (setq LyrColor "8") (setq LyrWeight "0.13")) ) (command "-Layer" "_M" NewLyrname "_C" LyrColor "" "_L" LyrLtype "" "LW" (if (= LyrWeight -3) "D" (/ LyrWeight 100.0)) "" "") (princ))(princ "\n Type {LAX} and choose your layer modifier ") Quote Link to comment Share on other sites More sharing options...
BlackBox Posted March 1, 2011 Share Posted March 1, 2011 You cannot divide a string by a real without converting the string to a number. Try replacing this line: (setq LyrWeight [b][color=red]"0.13"[/color][/b]) ... With this line: (setq LyrWeight [b][color=blue]0.13[/color][/b]) ... as you can pass numbers to command functions, when the command expects a value. Hope this helps! Quote Link to comment Share on other sites More sharing options...
kam1967 Posted March 1, 2011 Author Share Posted March 1, 2011 Thanks, Renderman. I finally figured it out that I just need to specify 13 because it gets divided by 100 anyways, so now the routine works as it should. Thanks though for shining some lights into the dark cavern of my mind. You cannot divide a string by a real without converting the string to a number. Try replacing this line: (setq LyrWeight [b][color=red]"0.13"[/color][/b]) ... With this line: (setq LyrWeight [b][color=blue]0.13[/color][/b]) ... as you can pass numbers to command functions, when the command expects a value. Hope this helps! Quote Link to comment Share on other sites More sharing options...
BlackBox Posted March 1, 2011 Share Posted March 1, 2011 Thanks, Renderman. You're welcome. Thanks though for shining some lights into the dark cavern of my mind. "There are two ways of spreading light; to be the candle or the mirror that reflects it." -Edith Wharton I dare say that I am nothing more than 'the mirror' at this stage in my life. :wink: 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.