Author Topic: Could somebody check me here ???  (Read 1395 times)

0 Members and 1 Guest are viewing this topic.

jlogan02

  • Bull Frog
  • Posts: 327
Could somebody check me here ???
« on: November 12, 2020, 05:25:54 PM »
It doesn't restore the current layer setting
It doesn't restore the Dimstyle.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:STA_DIMEN ( / )
  2. (setvar "filedia" 0)
  3. (setvar "osmode" 129)
  4. (setvar "dimclrt" 1)
  5. (setvar "dimclre" 1)
  6. (setvar "dimclrd" 1)
  7. (command "-Dimstyle" "Save" "DimenRed")
  8. (setq Clay (getvar "CLAYER"))
  9. (command "-layer" "M" "DIMEN" "")
  10. (command "dimlinear")
  11. (command "-dimstyle" "R" "DIMEN")
  12. (setvar "CLAYER" Clay)
  13. (setvar "filedia" 1)
  14.   (princ
  15. )
  16.   )

Probably going about it completely wrong.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

kpblc

  • Bull Frog
  • Posts: 396
Re: Could somebody check me here ???
« Reply #1 on: November 12, 2020, 11:43:46 PM »
You didn't finish command _.dimlinear. Try to change
Code - Auto/Visual Lisp: [Select]
  1. (command "_.dimlinear")
to
Code - Auto/Visual Lisp: [Select]
  1. (command "_.dimlinear" pause pause pause)
And you didn't check are dimstyles DimenRed and DIMEN really exist in current drawing.
Sorry for my English.

MatGrebe

  • Mosquito
  • Posts: 16
Re: Could somebody check me here ???
« Reply #2 on: November 13, 2020, 02:00:45 AM »
And
(command "-dimstyle" "R" "DIMEN")
to
(command "-dimstyle" "R" "DimenRed")
Mathias

HasanCAD

  • Swamp Rat
  • Posts: 1423
Re: Could somebody check me here ???
« Reply #3 on: November 13, 2020, 09:48:53 AM »
(defun c:STA_DIMEN ( / fd om dt de dd clay )
  (setq fd (getvar "filedia")) (setvar "filedia" 0)
  (setq om (getvar "osmode"))  (setvar "osmode" 129)
  (setq dt (getvar "dimclrt")) (setvar "dimclrt" 1)
  (setq de (getvar "dimclre")) (setvar "dimclre" 1)
  (setq dd (getvar "dimclrd")) (setvar "dimclrd" 1)
  (setq Clay (getvar "CLAYER")) (command "-layer" "M" "DIMEN" "")
  (command "-Dimstyle" "Save" "DimenRed") 
 ; (command "dimlinear")
  (command "_.dimlinear" pause pause pause)
  ;(command "-dimstyle" "R" "DIMEN")
  (setvar "CLAYER" Clay)
  (setvar "filedia" fd)
  (setvar "osmode" om)
  (setvar "dimclrt" dt)
  (setvar "dimclre" de)
  (setvar "dimclrd" dd) 
  (princ)
  )

jlogan02

  • Bull Frog
  • Posts: 327
Re: Could somebody check me here ???
« Reply #4 on: November 13, 2020, 12:23:21 PM »
Thanks guys,

You didn't finish command _.dimlinear. Try to change
Code - Auto/Visual Lisp: [Select]
  1. (command "_.dimlinear")
to
Code - Auto/Visual Lisp: [Select]
  1. (command "_.dimlinear" pause pause pause)
And you didn't check are dimstyles DimenRed and DIMEN really exist in current drawing.
I realized very early this morning that I should probably check if they exist. Pause Pause Pause. Crap!!!

And
(command "-dimstyle" "R" "DIMEN")
to
(command "-dimstyle" "R" "DimenRed")
Mathias

I am indeed trying to reset the dimstyle back to "DIMEN" which is the default. The save action sets the saved dimstyle current as desired. However, I think it best just two make to buttons, one that checks for each dimstyle and then sets it current. Rather than my approach.

(defun c:STA_DIMEN ( / fd om dt de dd clay )
  (setq fd (getvar "filedia")) (setvar "filedia" 0)
  (setq om (getvar "osmode"))  (setvar "osmode" 129)
  (setq dt (getvar "dimclrt")) (setvar "dimclrt" 1)
  (setq de (getvar "dimclre")) (setvar "dimclre" 1)
  (setq dd (getvar "dimclrd")) (setvar "dimclrd" 1)
  (setq Clay (getvar "CLAYER")) (command "-layer" "M" "DIMEN" "")
  (command "-Dimstyle" "Save" "DimenRed") 
 ; (command "dimlinear")
  (command "_.dimlinear" pause pause pause)
  ;(command "-dimstyle" "R" "DIMEN")
  (setvar "CLAYER" Clay)
  (setvar "filedia" fd)
  (setvar "osmode" om)
  (setvar "dimclrt" dt)
  (setvar "dimclre" de)
  (setvar "dimclrd" dd) 
  (princ)
  )

Thanks Hasan,

Yes, resetting saving and resetting would be a better approach. This way there is no error factor possible.


Thanks again guys.

J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10