Jump to content

Llayer modifier with lineweight


kam1967

Recommended Posts

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)))

(setq

LyrEdata (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 ")

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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. :D

 

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!

Link to comment
Share on other sites

Thanks, Renderman.

 

You're welcome. :)

 

 

Thanks though for shining some lights into the dark cavern of my mind. :D

 

"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:

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...