Jump to content

Lisp For inserting block with layer Help


usprecast

Recommended Posts

I was able to get help to get this command. First I wanted to insert a block as a lisp command. What i wanted was to be able to type FH and bring that block that i want to the location that i wanted and I was able to that with this lisp command:

 

 

(defun C:FH ()

 

(command "_.insert" "fire hydrant-dyn")

 

)

 

Now what I want to do is bring this block to scale 1 because right is bring it to scale 0 and I also want it to be on the layer that i have already created. ( I already have a template with layers and block and trying to make it simple for to insert blocks to different location because sometimes I have a big job with a lot of miles and i don't want to go back to the begining to copy and paste 5 miles down the road)

Link to comment
Share on other sites

Welcome to CADTutor .

 

Something along this ?

NOTE: Change the layer name in the program as show below in pink color .

 

 

(defun c:test (/ p)
 ;; Tharwat 24.11.2014    ;;
 (if (tblsearch "BLOCK" "fire hydrant-dyn")
   (while (setq
            p (getpoint
                "\n Specify point to locate block < fire hydrant-dyn >:"
              )
          )
     (entmake (list '(0 . "INSERT")
                    (cons 10 (trans p 1 0))
                    '(2 . "fire hydrant-dyn")
                    (cons 8 [color=magenta]"Layername"[/color])
                    '(41 . 1.0)
                    '(42 . 1.0)
                    '(43 . 1.0)
              )
     )
   )
   (princ
     "\n Block name < fire hydrant-dyn > is not found in drawing !!"
   )
 )
 (princ)
)

Link to comment
Share on other sites

An enhacement would be to have a look up table so when you enter "fire hyrdrant-dyn" it auto goes on the layer "FIRE HYD"

 

A better way would be to use tool palettes and pick the fire hydrant and as part of the hidden macro it would go on the correct layer or as we do use slide libraries.

Kerbs.jpg

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