Jump to content

Wblock dialog box


chiimayred

Recommended Posts

hey guys,

 

I am working on converting some 3d solids into usable 2D dynamic blocks and I am working on writing a quick little lisp that will help speed it up.

 

(defun c:test (/ obj obj2 bp name)
 (setq obj (entsel))
 (command
   "_-view" "_top"
   "flatshot" '(0 0) 1 1 0
   "_erase" obj ""
   "_explode" "_all"
   )
 (setq obj2 (ssget))
 (setq bp (getpoint "\nWhere is basepoint?: "))
 (setq name (getstring T "\nWhat is the name of the block?: "))
 (command
 "_block" name bp obj2 ""
 "_insert" name '(0 0) 1 1 0
 "wblock"
 )
 )

 

my issue is with the wblock command, is there a way to get the dialog box to open? if not i need to export the block file to a different file path (not every time but most)... what would be your approach?

 

Thanks!

Link to comment
Share on other sites

Have you tried issuing initdia just before the WBLOCK command? You need to break it out separately when doing so. E.g.

 

(initdia)
(command "WBLOCK")

Link to comment
Share on other sites

Have you tried issuing initdia just before the WBLOCK command? You need to break it out separately when doing so. E.g.

 

(initdia)
(command "WBLOCK")

 

It's all these little bits of code I don't know... Thanks!

Link to comment
Share on other sites

Are you going to incorporate the OVERKILL command in your new routine?

 

Now that you mention it, I probably will.

 

Also after adding the wblock command I realized that I don't need to create the block after the fshot. What happens is the block is exported inside of the drawing where i just need the lines to be present for my purposes.

 

(defun c:test (/ obj obj2 bp name)
 (setq obj (entsel));;select 3D to flatten
 (command
   "_-view" "_top"
   "flatshot" '(0 0) 1 1 0
   "_erase" obj "";;erase 3D entitiy
   "_explode" "_all";;explode fshot block
   "overkill" "_all"
   )
 (setq obj2 (ssget));;select newly create 2D lines
 (setq bp (getpoint "\nWhere is basepoint?: "));;Basepoint for Block
 (setq name (getstring T "\nWhat is the name of the block?: "));;name for block
 (initdia)
 (command
 "-wblock" "" name bp obj2
 )
 )

 

For some reason it's saying overkill is an unknown command

 

Also, with the FSHOT command it sets the lineweights to 0, what's the command to set the lineweight to bylayer?

Link to comment
Share on other sites

Here's the updated code that I'm using in case anyone else will find this useful.

 

Added some error checking. Still can't figure out the lineweight thing after the fshot, but i can change that later anyway.

 

(defun c:Z (/ obj obj2 bp un)
 (if (setq un (getint "\nWhat are your units? 1-Inches 2-Feet 3-Millimeters 4-Meters "))
   (progn
     (cond
((= un 1)
 (command
   "_.insunits" 1 ""
   );;end command
 )
((= un 2)
 (command
   "_.insunits" 2 ""
   );;end command
 )
((= un 3)
 (command
   "_.insunits" 4 ""
   );;end command
 )
((= un 4)
 (command
   "_.insunits" 6 ""
   );;end command
 )
((> un 4)
 (alert "PLEASE SELECT APPROPRIATE UNITS")
 )
((< un 1)
 (alert "PLEASE SELECT APPROPRIATE UNITS")
)
     )
     )
   (alert "PLEASE SELECT APPROPRIATE UNITS")
   )
 (IF (setq obj (entsel));;select 3D object to flatten
   (progn
     (command
"_-view" "_top"
"flatshot" '(0 0) 1 1 0
"_.erase" obj "";;erase 3D entitiy
"_.explode" "_all";;explode fshot block
"_.overkill" "_all"
)
 (setq obj2 (ssget));;select newly create 2D lines
 (setq bp (getpoint "\nWhere is basepoint?: "));;Basepoint for Block
 (initdia)
 (command
 "-wblock" "" bp obj2 ""
 "_.CLOSE" "Y"
 )
 )
 (alert "NO OBJECTS SELECTED!"))
 (princ)
 )

Edited by chiimayred
updated code for insunits
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...