Kostritz Posted February 4, 2009 Posted February 4, 2009 I've been trying unsuccessfully to create a script/macro that does the following from within a sheet file with a base plan xref: -user input: active viewport -user input: plan, RCP, demolition, enlarged plan -load the vplayer linetypes, colors, and visibility appropriate to the selected view mode above Behind the scenes, I have created a base plan template on our server with .las files for each of the appropriate layer settings so they can be called by the script. I had hoped that I could have a combination of scripts and macros do the job of: -entering the model space of the viewport selected -assigning the selected layer settings for the xref layers appropriate to the user selected view (plan, etc) -making vplayers=modelspace layers and then -return the xref to base settings in model space while retaining the newly created vp settings. This may seem overly complicated, but the reason I want to do it this way is to allow our office to create a base resource for layer settings in the form of a template with layerstates; that way, if we have to change settings in the future, we change it once - the script can be run on any new and old files to make the change. I think I can figure out most of the above...but I'm stuck on assigning modelspace xref layers to vplayer settings and having them "stick" in the viewport. If I could access a variable for each layer property and assign it to a variable for vp settings for that layer, it would be a simple matter of using something like *base*|* for the layer name and having the script go through all of the layers. Is there a way to do this? Without access to LISP (AutoCAD LT), this seems difficult. Thanks for reading this far...I couldn't come up with a more concise way to put the question! Quote
Kostritz Posted February 5, 2009 Author Posted February 5, 2009 Well, here I am answering my own question...but perhaps someone more knowledgable can comment - I'm in pretty deep water here. So, I created a macro as follows: ^C^C_-vports \\mspace;z;c \;z;s \'_script This creates a new viewport, which gets user input to pick points, center the plan in model space, and then for the scale of the viewport. It's assumed that the user has already loaded the base-plan xref. I was looking for a way to make scale entry simpler...putting in "1/48xp" for quarter scale isn't very intuitive. Then, I created a script for the user to run from within the macro: ;This script creates a plan layer setup within a viewport XREF RELOAD *BASE* VPLAYER FREEZE *BASE*|* FREEZE A-ANNO-NOTE* FREEZE A-ANNO-DIMS* THAW A-ANNO-NOTE-PLAN THAW A-ANNO-DIMS-PLAN THAW *A-FLOR* THAW *A-EXST-FLOR* THAW *A-EXST-WALL* THAW *A-WALL* PSPACE This does the job of setting up the layers to print properly from within the viewport. It isn't perfect, and there's no error checking. Now I just have to create the other scripts (RCP, Demo, etc). As for using variables in macros from my first post: the setenv command creates random variables...but I'm thinking my current route is probably the best. Comments? Quote
rholguin Posted May 24, 2010 Posted May 24, 2010 whats your work around for running the script in a drawing that doesn't have any layers with those suffix or prefix? "No matching layer names found." Quote
Recommended Posts
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.