Jump to content

Recommended Posts

Posted
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)
)

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    17

  • The Buzzard

    7

  • MichaelJ07

    7

  • adamsnez

    5

Top Posters In This Topic

Posted

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

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

Posted

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

Posted

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

Posted

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 :cry:

Posted
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 :cry:

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.

Posted

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

Posted
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. :)

Posted

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

Posted

Sorry about that, Repositioned (graphscr)

 

See previous post.

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

Posted
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. :)

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

Posted
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?

Posted

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.

Posted

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

Posted
If things go badly, there's always post #3 :D

There's always that. :) I think he was just wanting to stick with a simple approach that he'd have an easier time deciphering.

Posted
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. :wacko:

 

You're very welcome.

 

It wasn't a thread jack, you were just piggy-backing on what the OP asked for.

Posted

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

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