Author Topic: Viewport layer filter  (Read 3146 times)

0 Members and 1 Guest are viewing this topic.

PitchBlack98

  • Guest
Viewport layer filter
« on: April 12, 2006, 03:24:42 PM »
I am working on a lisp that will setup VPs to only show certain layers. I am drafting different foundation types on one drawing so they are stacked. I have one drawing with 54 foundations all in separate tabs. Its taking me forever to set up each and every tab to freeze layers I dont need. I have a routine working, but an having problems getting it to work without a lot of interaction. My tab names and foundation types all correspond to each other with an elevation designation (IE "STDA(NSG)" That would be elev. A standard foundation with narrow spread footings with slab on grade). Is is possible to create a lisp that will check the tab names and apply the right VP filter to the viewports on that tab.

Heres what I have working so far. The viewport has to be active for the layers to freeze in it since Im using vplayer and it asks for the layer name then the viewport to freeze it in everytime. Any help is appreciated. What I have now is a little quicker, but not much.

Thanks in advance!

Code: [Select]
;;FOUNDATION TYPE ROUTINE
;;Makes stacked foundation layers visible in viewports to seperate them on
;;different tabs
(defun C:FDNTYPE (/ cmd att clay p)
 ;;GET VARIABLES
 (setq cmd  (getvar 'cmdecho)
att  (getvar 'attdia)
clay (getvar 'clayer))
 ;;SET LAYER TO ZERO
 (COMMAND "-LAYER" "THAW" "0" "SET" "0" "" "")
 (setvar 'cmdecho 0)
 (setvar 'attdia 1)
 ;;Set the foundation types allowed
 (initget 0 "CSG CST NSG NST PSG PST")
 (setq P (cond ((getkword "\nFoundation Type: CSG / CST / NSG / NST / PSG / PST: "))
("A")))
;;CSG ONLY
       (if (= P "CSG")
     (progn (command "VPLAYER" "F" "CS-STEEL" "CURRENT" "F" "NS*" "CURRENT" "F" "PS*" "CURRENT" "F" "S-PIER*"

"CURRENT" "F" "S-STEEL" "CURRENT" "")))
;;NSG ONLY
       (if (= P "NSG")
     (progn (command "VPLAYER" "F" "NS-STEEL" "CURRENT" "F" "CS*" "CURRENT" "F" "PS*" "CURRENT" "F" "S-PIER*"

"CURRENT" "F" "S-STEEL" "CURRENT" "")))
 ;;;
 ;;RESET VARIABLES
 (setvar "attdia" att)
 (setvar "clayer" clay)
 ;;EXIT
 (princ)
 )

CADaver

  • Guest
Re: Viewport layer filter
« Reply #1 on: April 12, 2006, 03:28:32 PM »
I am drafting different foundation types on one drawing so they are stacked. I have one drawing with 54 foundations all in separate tabs.
I understand the different tabs, and I understand the different foundation types, but why stack 'em??

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Viewport layer filter
« Reply #2 on: April 12, 2006, 05:23:50 PM »
I don't think I fully understand what you want, but to get the current tab name use
(getvar "ctab").
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

PitchBlack98

  • Guest
Re: Viewport layer filter
« Reply #3 on: April 12, 2006, 05:27:50 PM »
We stack them so if there are redlines or any changes they can be made to all the foundations at the same time. Depending on all the options and elevations we can have a lot of drawings.

The project I'm working on now has 54 sheets for just the foundation and it's a shoebox house. I've tried to sell the xref idea, but no one wants to try it because the don't understand xrefs and how they work. It's very irritating, I know, but theres nothing I can do about it. I've been setting up this drawing for 4 days now and I'm only about 80% done with it. I have 7 more houses to do that are very similar. I'm hoping to have this lisp working so it helps with the rest of these stupid houses....  :realmad: lol

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Viewport layer filter
« Reply #4 on: April 12, 2006, 05:46:09 PM »
Welcome to the swamp.

Can you attach a sample drawing?

I stack my houses as well. Foundation, floor 1, floor 2, Framing 1, Framing2, elect1, elect2,  etc.
They share some layers, walls, windows, doors etc.
Works for me. :-)


Does it make sense to Freeze all layers in the VP, then thaw the ones you want visible?
« Last Edit: April 12, 2006, 06:00:24 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

PitchBlack98

  • Guest
Re: Viewport layer filter
« Reply #5 on: April 12, 2006, 06:11:20 PM »
Heres the actually drawing I'm working on now. I removed all client info so I don't get in trouble. I also had to delete the 4 car garage option to make the file small enough to attach here. It's bascially the same as what's still in the drawing.

All the tabs are set up the way I want them so they filter out the different foundation type depending on what tab I'm on. I want a lisp that will either let me select the foundation type I want and let me pick the viewport that I want to display it or one that will read my tabs and if it sees NSG on the tab it freezes all the layers needed to only display the NSG foundation in that tab's viewport. Does that make sense?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Viewport layer filter
« Reply #6 on: April 12, 2006, 08:25:52 PM »
Thanks for the look at the drawing.
Should be easy with some helper routines.
Go here
Look at the last post, there are two attachments.
See if that does it for you.


pseudo code

Code: [Select]
Loop through layouts
  get viewport, should be only one per tab
  get list of freeze layers from data list using tab name
  thaw all layers in vp
  freeze predefined layers from list (check for current layer)
end of loop
« Last Edit: April 12, 2006, 08:32:57 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

PitchBlack98

  • Guest
Re: Viewport layer filter
« Reply #7 on: April 12, 2006, 09:20:03 PM »
Thanks for that link. Ill check them out tomorrow and see if I can use them to do what I want to do. Appreciated much...