Jump to content

Recommended Posts

Posted

Basicly im sick of people at work pasting a item as a block from another dwg.

so my lisp is to basicly as for a name, and place it on a nice layer.

the problem is.

how do i select items just pasted it, "L" selects the last line not the entire thing "p" donsnt do anything.

 

any idears

 

chears

while im asking can some one explain "strcat" a bit more or show me an example plz

cheers

(Defun C:bk1 ()
(setvar "cmdecho" 0)
(setq isp(getpoint "\nSelect insert point: "))
(setq bkn(getstring "\nWhat is the name of the block: "))
;(setq ep (getkword "Plan or Elevation :"))
;(if (= ep p)(setq pl (plan)
:(setq pl (Elevation)
;(strcat (setq Tn (bk pl)))  
_paste 
(command "_block" tn bpt ?? "")

Posted

Hi Flowerrobot,

 

I happen to notice that you use "strcat" to combine "bk" (Block Name) and "pl" (Orientation). However, earlier in the LISP you set the variable of the block name to "bkn".

 

strcat is useful for combining two strings, and in your case, if you want to combine the strings "bkn" & "pl", you should possibly use something like this:

 

(Defun C:bk1 ()
(setvar "cmdecho" 0)
(setq isp(getpoint "\nSelect insert point: "))
(setq bk (getstring "\nWhat is the name of the block: "))
(initget 1 "Plan Elevation")
(setq ep (getkword "Plan or Elevation :"))
(if (= ep p)
  (setq pl (plan))
  (setq pl (Elevation))
)
(setq tn (strcat bk pl))
(command "-insert" tn isp "" "" "")
(setvar "cmdecho" 1)
)

Hope this helps

Posted

Thank you very much, sorry about the name stuff ups, it was copying most from a code i have just writen, with similars commands.

 

This is how the code is looking now, Do you know how i would select an item ive pasted in (not sure if _paste, is the correct command yet)

im not even sure if this can be done, i would like to turn the (paste as block command) and turn that to paste as block, but you must give it a name, where ill changed the crl+shift+v(i think) in the cui to run bk1 instead.

also if it possible to get the dwg name incorpriated from the drawing it was coppied from, say i copys an item from P0677-T50-8000. can i incorpriate in so it will have ("P0677-T50" tn)

 

thanks for you help

 

(Defun C:bk1 ()
(setvar "cmdecho" 0)
(setq isp(getpoint "\nSelect insert point: "))
(setq bkn(getstring "\nWhat is the name of the block: "))
(initget 1 "P E")
(setq ep (getkword "Plan or Elevation :"))
(if (= ep p)
  (setq pl "plan")
  (setq pl "Elevation")
(setq tn (strcat bkn pl))
[b](command "_.paste ")[/b]
[b](command "_block" ep isp ?? "")[/b]
(setvar "cmdecho" 1)

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