Jump to content

lisp commands


TunzaGibbo

Recommended Posts

I want my lisp file to insert a block in a certain way.

After "_insert" I would like the program to go to a specific folder where I keep my blocks.

This code works fine if I have a block name where the question marks are. Is there some code I can enter where the question marks are to get the dialogue box?

(command "_insert" "??????????" pause 1 "" 0 )

 

Link to comment
Share on other sites

Thank you Lee

(command "_insert" "C:\\Users\\Tony Clean Install\\#Advance\\Blocks\\Cameras\\Camera HD Detail.dwg" pause 1 "" 0 )

if I was to use this line (which works well) How could I incorporate in this line the ability to explode the block

 

regards

 

Tony

 

 

 

Link to comment
Share on other sites

(if (and
    (vl-cmdf "_insert" "C:\\Users\\Tony Clean Install\\#Advance\\Blocks\\Cameras\\Camera HD Detail.dwg" pause 1 "" 0 )        ; inser block
    (setq CMHDD (ssget "x" '((0 . "INSERT") (2 . "Camera HD Detail"))))
    )    
    (progn
      (vl-cmdf "_.EXPLODE" CMHDD "")
      (vl-cmdf "_.-purge" "blocks" "Camera HD Detail" "n")
      ))

Link to comment
Share on other sites

Alternatively, you could use something like this:

(setq pth "C:\\Users\\Tony Clean Install\\#Advance\\Blocks\\Cameras\\Camera HD Detail.dwg"
      blk (vl-filename-base pth)
)
(if (or (tblsearch "block" blk)
        (and
            (or (findfile pth)
                (prompt (strcat "\n" pth " not found."))
            )
            (or (progn
                    (command "_.-insert" pth nil)
                    (tblsearch "block" blk)
                )
                (prompt (strcat "\n" blk " could not be defined."))
            )
        )
    )
    (command "_.-insert" (strcat "*" blk) "\\" 1 0)
)

 

  • Like 1
Link to comment
Share on other sites

Thankyou everyone for your contributions.

This is what I am finally using and it works perfect.

(command "_insert" "Camera HD Detail.dwg" pause 1 "" 0)(setq blex (entlast))(command "_explode" blex)

 

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