DubweiserTM Posted April 28, 2010 Posted April 28, 2010 Hi everybody ! Im very new to VBA for autocad, I searched on this site but no corresponding subject. I want to VP Freeze a Xref layer in a specific layout with a VBA Macro... Layer name: 88888 - Module A|Details Layout name: Production (3 viewports within) Is someone could help me ? Thanks in advance ! Quote
alanjt Posted April 29, 2010 Posted April 29, 2010 I don't mean you rain on your VB parade, but if you are new to it, I feel you should be aware that after v2011 isn't no longer going to be available and Microsoft has completely abandoned it (it's available in 32 bit systems, but not 64). Quote
DubweiserTM Posted April 29, 2010 Author Posted April 29, 2010 What do you suggest me in that case ? Is it the same thing for VBNet ? Quote
alanjt Posted April 29, 2010 Posted April 29, 2010 What do you suggest me in that case ? Is it the same thing for VBNet ? VB.NET is the new baby. Quote
DubweiserTM Posted April 29, 2010 Author Posted April 29, 2010 I know a little bit VBNet, which VBNet file Autocad will use as macro ? I dont think that autocad will use and exe file... Quote
alanjt Posted April 29, 2010 Posted April 29, 2010 I know a little bit VBNet, which VBNet file Autocad will use as macro ? I dont think that autocad will use and exe file... .dll ........... Quote
alanjt Posted April 29, 2010 Posted April 29, 2010 Just a thought... If you are wanting to select objects on these layers, you can use LayFrz and it will VPFreeze layers for you. Quote
DubweiserTM Posted April 29, 2010 Author Posted April 29, 2010 It's because I have many layers from an XREF to freeze in a viewport and I want to do that by a macro to save time to the drawing department... The problem it's the Xref never has the same name... For the current drawing it's easy I can preset the layer in my template, but for the Xref it's not the same thing.. Quote
alanjt Posted April 29, 2010 Posted April 29, 2010 Oh ok, then use VPLayer. All XRef layers will have | in their name, so you can just filter by something like *|FullLayerName or *|*PartialLayerName eg. Command: V VPLAYER Enter an option [?/Color/Ltype/LWeight/Freeze/Thaw/Reset/Newfrz/Vpvisdflt]: F Enter layer name(s) to freeze or <specify layers by object selection>: *|*STORM* This will freeze all XRef layers that have STORM in them. eg. Command: V VPLAYER Enter an option [?/Color/Ltype/LWeight/Freeze/Thaw/Reset/Newfrz/Vpvisdflt]: F Enter layer name(s) to freeze or <specify layers by object selection>: *|P-STORM* This will freeze all XRef layers that start with P-STORM. Quote
DubweiserTM Posted April 29, 2010 Author Posted April 29, 2010 Is it possible to do that with a macro ? As per the dll, do you have some tutorial for that ? Thanks for your help I appreciated very much ! Quote
alanjt Posted April 29, 2010 Posted April 29, 2010 Is it possible to do that with a macro ? As per the dll, do you have some tutorial for that ? Thanks for your help I appreciated very much ! Button macro? THis could also be easily solved with a little LISP. Quote
DubweiserTM Posted April 29, 2010 Author Posted April 29, 2010 Button macro or via command line... Is visual lisp is simple to learn ??? Quote
alanjt Posted April 29, 2010 Posted April 29, 2010 Button macro or via command line... Is visual lisp is simple to learn ??? Not too bad. Here's a quickie I did a few days ago that will VPFreeze specified layers in selected layouts. http://www.cadtutor.net/forum/showpost.php?p=321317&postcount=3 Quote
DubweiserTM Posted April 29, 2010 Author Posted April 29, 2010 Now im reading a VisualLisp tutorial that I saw in your signature, I hope that VisualLisp will never "die" as VBA in the futur ! After that I will check your lisp routine... Thanks ! Quote
alanjt Posted April 29, 2010 Posted April 29, 2010 Now im reading a VisualLisp tutorial that I saw in your signature... After that I will check your lisp routine... Thanks ! No problem. Keep me posted. Quote
DubweiserTM Posted April 29, 2010 Author Posted April 29, 2010 After reading some tutorials, I check your lisp routine, I dont understand all the lines, but now a know a little bit more than this morning ! Could you tell me if I can VPFreeze a layer in a specific layout via the model space ? In what I found I have to enter in the viewport and select an object... ;--------------------------------------------------------------------------------------- ; To Freeze Layer of Picked Entity ONLY in current Viewport ;--------------------------------------------------------------------------------------- (defun c:vlf () (prompt "\nPick entity on the layer you want freeze in this Viewport: ") (setq name (cdr (assoc 8 (entget (car (entsel)))))) (command "_vplayer" "f" name "" "") (princ) ) Quote
alanjt Posted April 30, 2010 Posted April 30, 2010 If you are wanting to VPFreeze a layer from model, you'd need to be able to make the selection. Now, you can make the changes with entmod (which would avoid having to change layouts). However, let's keep it simple for the time being. Now, if you look at what I posted, it is an example of how to VPFreeze specified layers in all viewports existing on the selected layouts. Which means you can VPFreeze any amount of layers in any layouts without having to change your current layout (eg. staying in Model). After reading some tutorials, I check your lisp routine, I dont understand all the lines, but now a know a little bit more than this morning ! Could you tell me if I can VPFreeze a layer in a specific layout via the model space ? In what I found I have to enter in the viewport and select an object... ;--------------------------------------------------------------------------------------- ; To Freeze Layer of Picked Entity ONLY in current Viewport ;--------------------------------------------------------------------------------------- (defun c:vlf () (prompt "\nPick entity on the layer you want freeze in this Viewport: ") (setq name (cdr (assoc 8 (entget (car (entsel)))))) (command "_vplayer" "f" name "" "") (princ) ) Quote
DubweiserTM Posted April 30, 2010 Author Posted April 30, 2010 When I try to go to AT:ListSelect subroutine I received this message: Invalid Thread specified. If you followed a valid link, please notify the administrator As per your lisp when you wrote "how to VPFreeze specified layers in all viewports existing on the selected layouts..." On the selected layouts is it selected somewhere in the lisp routine or I have to select a layout in the drawing ??? Quote
alanjt Posted April 30, 2010 Posted April 30, 2010 When I try to go to AT:ListSelect subroutine I received this message: Invalid Thread specified. If you followed a valid link, please notify the administrator As per your lisp when you wrote "how to VPFreeze specified layers in all viewports existing on the selected layouts..." On the selected layouts is it selected somewhere in the lisp routine or in the drawing ??? Sorry about that. I had David remove the thread (had become an unorganized mess). I posted the subroutine in the original thread. Check the link in my early post. Quote
DubweiserTM Posted April 30, 2010 Author Posted April 30, 2010 I check your lisp routine, oh boy ! It's not for beginner ! Is there an easy way to do that ? If I know the layout and layers name and if Im sure that these names will never change... 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.