alanjt Posted April 30, 2010 Posted April 30, 2010 It brings up the F2 box and I can't figure out why. I probably missed something in the code. How odd. There's nothing in the code that would bring it up. Here's my original of the code. (defun c:test (/ e) (and (setq e (car (entsel "\nSelect Dimension: "))) (or (eq "DIMENSION" (cdr (assoc 0 (setq e (entget e))))) (alert "Invalid object!") ) (setvar 'clayer (cdr (assoc 8 e))) (command "_.-dimstyle" "_restore" (cdr (assoc 3 e))) ) (princ) ) Quote
MichaelJ07 Posted April 30, 2010 Posted April 30, 2010 Ok, I understand. Don't know why. I've got a print screen of it, but ain't figured out yet how to get it in this message. I'll work on that. Here's my F2 readout for now: Command: Command: Automatic save to C:\DOCUME~1\Michael\LOCALS~1\Temp\Drawing1_1_1_8467.sv$ ... Command: Command: Command: _test Select Dimension: _.-dimstyle Current dimension style: Architectural Enter a dimension style option [save/Restore/STatus/Variables/Apply/?] : _restore Enter a dimension style name, [?] or : Woodshop Current dimension style: Woodshop Here's the code I have in the lisp which I copied from the thread. Everything looks good, except that darn F2 looking thing! The code: (defun c:test (/ e) (and (setq e (car (entsel "\nSelect Dimension: "))) (or (eq "DIMENSION" (cdr (assoc 0 (setq e (entget e))))) (alert "Invalid object!") ) (setvar 'clayer (cdr (assoc 8 e))) (command "_.-dimstyle" "_restore" (cdr (assoc 3 e))) ) (princ) ) test_lsp.pdf Quote
MichaelJ07 Posted April 30, 2010 Posted April 30, 2010 When I type -dimstyle at the command line, not only does the command run, but the F2 text window appears. Now, why in the world would it do that I wonder? My machine must be tired... Quote
The Buzzard Posted April 30, 2010 Posted April 30, 2010 I just tested this code and it on the dime. Nice and simple Alan. (defun c:test (/ e) (and (setq e (car (entsel "\nSelect Dimension: "))) (or (eq "DIMENSION" (cdr (assoc 0 (setq e (entget e))))) (alert "Invalid object!") ) (setvar 'clayer (cdr (assoc 8 e))) (command "_.-dimstyle" "_restore" (cdr (assoc 3 e))) ) (princ) ) Quote
MichaelJ07 Posted April 30, 2010 Posted April 30, 2010 Maybe the text window is coming up on mine because I have the lisp outside the support search path for Acad to find it? I guess it doesn't really matter where the file is stored if I just drag it into an open drawing and it loads successfully then it should run successfully. The other posted code works, but shoot, I want this one to work because of its simplicity. Thanks for posting a result. Now, once again, I know it's little old me and my little old 2002 Quote
The Buzzard Posted April 30, 2010 Posted April 30, 2010 Maybe the text window is coming up on mine because I have the lisp outside the support search path for Acad to find it? I guess it doesn't really matter where the file is stored if I just drag it into an open drawing and it loads successfully then it should run successfully. The other posted code works, but shoot, I want this one to work because of its simplicity. Thanks for posting a result. Now, once again, I know it's little old me and my little old 2002 I also tested the code at the beginning of this thread as well and it also worked. You should not need to set a path for it unless the code was dialog operated. I placed two different dimstyles each with a dimension in my drawing on two different layers. I run the code and it sets the correct style and layer. If I select an object thats not a dimension I get an Invalid Object alert box. No matter how much I tried to screw it up, It was well error trapped. Quote
alanjt Posted April 30, 2010 Posted April 30, 2010 Not sure why it's going it, but there's always a beat-to-fit method... (defun c:test (/ e) (and (setq e (car (entsel "\nSelect Dimension: "))) (or (eq "DIMENSION" (cdr (assoc 0 (setq e (entget e))))) (alert "Invalid object!") ) (setvar 'clayer (cdr (assoc 8 e))) (not (command "_.-dimstyle" "_restore" (cdr (assoc 3 e)))) (graphscr) ) (princ) ) If it's popping up, we'll just turn it off. Quote
alanjt Posted April 30, 2010 Posted April 30, 2010 I just tested this code and it on the dime.Nice and simple Alan. (defun c:test (/ e) (and (setq e (car (entsel "\nSelect Dimension: "))) (or (eq "DIMENSION" (cdr (assoc 0 (setq e (entget e))))) (alert "Invalid object!") ) (setvar 'clayer (cdr (assoc 8 e))) (command "_.-dimstyle" "_restore" (cdr (assoc 3 e))) ) (princ) ) Thanks. Quote
The Buzzard Posted April 30, 2010 Posted April 30, 2010 You could also add this line in red: (defun c:test (/ e) (and (setq e (car (entsel "\nSelect Dimension: "))) (or (eq "DIMENSION" (cdr (assoc 0 (setq e (entget e))))) (alert "Invalid object!") ) (setvar 'clayer (cdr (assoc 8 e))) (command "_.-dimstyle" "_restore" (cdr (assoc 3 e))) ) [color="Red"](graphscr)[/color] (princ) ) Quote
The Buzzard Posted April 30, 2010 Posted April 30, 2010 Sorry about that, Repositioned (graphscr) See previous post. Quote
The Buzzard Posted April 30, 2010 Posted April 30, 2010 Thanks. Your welcome Alan, Sorry, I did not know you were there. I recall this same issue with an older version of ACAD when I created My own dimstyle manager. The (graphscr) ended the problem. I guess we will see shortly. Quote
alanjt Posted April 30, 2010 Posted April 30, 2010 You could also add this line in red: (defun c:test (/ e) (and (setq e (car (entsel "\nSelect Dimension: "))) (or (eq "DIMENSION" (cdr (assoc 0 (setq e (entget e))))) (alert "Invalid object!") ) (setvar 'clayer (cdr (assoc 8 e))) (command "_.-dimstyle" "_restore" (cdr (assoc 3 e))) ) [color=Red](graphscr)[/color] (princ) ) Sorry about that, Repositioned (graphscr) See previous post. We had the same idea. Look at my post #27. Quote
The Buzzard Posted April 30, 2010 Posted April 30, 2010 We had the same idea. Look at my post #27. Sorry Alan, I did not see that. But it amazes me that did not work. That is a screen toggle. Quote
alanjt Posted April 30, 2010 Posted April 30, 2010 Your welcome Alan, Sorry, I did not know you were there. I recall this same issue with an older version of ACAD when I created My own dimstyle manager. The (graphscr) ended the problem. I guess we will see shortly. No problem. Fix away. Sorry Alan, I did not see that. But it amazes me that did not work. What didn't work? Quote
The Buzzard Posted April 30, 2010 Posted April 30, 2010 Oh! Ok I thought he still had a problem. I did not see his response. I must have been writing my post during that time. Alls well that ends well. Quote
MichaelJ07 Posted April 30, 2010 Posted April 30, 2010 Thanks, Alan, buzz, and Lee Mac. Alan, your addition fixed it. Lee, yours worked on my system as well. I'm amazed how you folks can write these routines. Always more to learn, huh? Again, thanks for the help. Man, I sure hope the OP got his question answered. I seemed to have hijacked his post. Sorry. M Quote
alanjt Posted April 30, 2010 Posted April 30, 2010 If things go badly, there's always post #3 There's always that. I think he was just wanting to stick with a simple approach that he'd have an easier time deciphering. Quote
alanjt Posted April 30, 2010 Posted April 30, 2010 Thanks, Alan, buzz, and Lee Mac.Alan, your addition fixed it. Lee, yours worked on my system as well. I'm amazed how you folks can write these routines. Always more to learn, huh? Again, thanks for the help. Man, I sure hope the OP got his question answered. I seemed to have hijacked his post. Sorry. M Good deal. It still puzzles me. I almost want to find a copy of v2002 and try it myself. You're very welcome. It wasn't a thread jack, you were just piggy-backing on what the OP asked for. Quote
MichaelJ07 Posted April 30, 2010 Posted April 30, 2010 I do have my share of weird happenings on this system. I look at it like finding a hunk of lead shot while eating a brace of pheasant. 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.