Jump to content

Delete all layers except current


woodman78

Recommended Posts

Yep, you could use the getfiled function to ask for the filename. If you send it the dwg extension is looks very much the same as a saveas (including the preview box).

Link to comment
Share on other sites

  • Replies 34
  • Created
  • Last Reply

Top Posters In This Topic

  • woodman78

    14

  • BlackBox

    9

  • irneb

    6

  • vnanhvu

    2

Top Posters In This Topic

Posted Images

Woodman78, you're killing me....

 

I get your points about the wblock and I did consider it but I won't be saving the drawing to the same location each time. The user will choose the save location.

...

If I was to do wblock could I invoke a dialog to choose the folder to save the drawing to and the drawing name. A bit like saveas?

 

Have you never used wblock before? :unsure:

 

The wblock dialog has a button to both browse and named the new file already included:

 

CT_wblock.png

 

... Never mind the QSELECT button in the upper right, which allows quick access to selecting all objects on a specified layer.

 

I know there are a few guys here who get freaked out by anything that isn't an open or save dialog box.

 

These individuals use Civil 3D!? :?

 

Regardless, this is a training issue, and *should* be the least of your concerns as you develop functions... never mind in this case where you're simply using a core AutoCAD command.

 

These individuals need to be educated on the capabilities of the platform on which they work, and get over their tendency to "get freaked out by anything that isn't an open or save dialog box."

 

Failing to resolve this personal issue will continue to hold your production team back, and make additional technological advances all the more difficult.

Link to comment
Share on other sites

Oh believe me I know Renderman, oh I know. I went to management recently and got them to back me up on pushing standards through. I have one guy here and he asks me the same thing over and over again. If I show him something he says yeah and then the next time he asks as if he's never been shown. It is very frustrating but I have to work with what we have. I am trying to bring him along but it is very slow.

 

And believe me I am very used to using wblock. But I am also aware of reality and reality is that some of these guys aren't very used to CAD or experienced. I have done along of work on standards. I have creates lisps for many aspects of our work and I have created standard legend blocks and standard notes. But I realised quite early on the the carrot is much more effective than the stick.4.png

1.png

2.png

3.jpg

Link to comment
Share on other sites

I added the getfiled to my lisp and it does bring up the dialog box and I enter a filename and it appears to save it but it actually doesn't.

 

This is what I have.

(defun C:townland (/ pline SUCE SUOM SUSM SUAB SUAD SUCL SUCR)
(setq SUCE (getvar "cmdecho"))
 (setq SUOM (getvar "orthomode"))
 (setq SUSM (getvar "osmode"))
 (setq SUAB (getvar "angbase"))
 (setq SUAD (getvar "angdir"))
 (setq SUCL (getvar "clayer"))
 (setq SUCR (getvar "cecolor"))
(setq vl1 (list
       (cons 0 "LAYER")        ;Name of entity
       (cons 100 "AcDbSymbolTableRecord")                    ;Open Records
       (cons 100 "AcDbLayerTableRecord")                    ;Locate Layer Table
       (cons 2 "CCC_LAYOUT_Townland_Boundary")                ;Name of Layer
       (cons 6 "Continuous")                        ;Linetype
       (cons 62 7)                            ;colour = light grey
       (cons 70 0)                            ;state
       (cons 290 1)                            ;1=plot, 0=Don't plot
           )                            ;End of entity list
       )
       (entmake vl1)
(setvar "clayer" "CCC_LAYOUT_Townland_Boundary")  
(setq ptlist nil)
   (while
       (setq pline(entsel "\nSelect a line or press ENTER when finished: "))
       (command "_.insert" "townland_boundary" nil)
       (command "measure" pline "b" "townland_boundary" "y" "5" "")
       (setq ptlist (append ptlist (list pt)))
   ) 
       (setq SS1 (ssget "X" (list '(0 . "INSERT") (cons 2 "townland_Boundary"))))

(getfiled "Save Townland Boundary XREF" "" "dwg" 1)

 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (setvar "cecolor"    SUCR)
(princ) 
)

Link to comment
Share on other sites

No worries; I hope I've not harped on you too bad. :oops:

 

Thanks for clarifying the situation - that makes much more sense now. It is unfortunate that you have to go this far out of the way in order to give your users something more easily accepted by their in-experience level.

 

Keep on, keeping on.... :beer:

Link to comment
Share on other sites

The getfiled just gives you the name & path of the file. You still need to send that to somewhere (e.g. to the wblock command, or even the saveas). It's a general purpose file selection dialog, it doesn't actually do anything on its own.

Link to comment
Share on other sites

Thanks Irneb. This is what I have now:

 

(setq saref (getfiled "Save Townland Boundary XREF" "" "dwg" 1))
(command "._wblock" saref "" "_None" '(0.0 0.0 0.0) (ssget "_X" (list (cons 8 (getvar "CLAYER")))) "")

 

using your earlier code. It works great apart from the very last part where it asks to include Map info or not. I've tried adding a "n" into the wblock command but no joy. How do I get around this one?

Link to comment
Share on other sites

I'm sorry I don't have map/civil so mine doesn't ask for another query. Is the default answer "N"? Perhaps just add another blank string "" (as if enter). Or else look if the full word No should be passed, or perhaps "_No" to allow for other languages.

 

BTW, you can check if the command has completed, if not keep passing enters:

(while (/= (logand (getvar "cmdactive") 1) 0) (command ""))

Link to comment
Share on other sites

FYI - The last dailog simply asks if the user wants to include Map data. I'd have to dig into it as I cannot recall, but perhaps a simple expert variable setting manipulation will resolve this.

Link to comment
Share on other sites

FYI - The last dailog simply asks if the user wants to include Map data. I'd have to dig into it as I cannot recall, but perhaps a simple expert variable setting manipulation will resolve this.
Perhaps something like FileDia? I know there's one or two commands around which pop open their dialogs even though they're called from lisp/script. Otherwise perhaps use the hyphen (minus sign) prefix on the wblock:
(command ".-_wblock" ;...

Link to comment
Share on other sites

I can't remember what it was... I thought is was the expert, or qaflags sysvar, but I cannot get it to prevent the suplemental dialog. Fildedia doesn't do anything either, nor cmddia.

 

If I remember, I'll post back... I could have sworn I had used this very functionality in a routine last year. :frustrated:

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