Author Topic: M-dub ~ I need you input here  (Read 4061 times)

0 Members and 1 Guest are viewing this topic.

hendie

  • Guest
M-dub ~ I need you input here
« on: May 21, 2004, 06:12:54 AM »
Mike,
I'm trying something out for our less computer literate operators here.
They plot drawings from AMW but I need a layer hidden before they plot and then reinstated after plotting.
I've run the following code in the Baselisp evaluator and am getting 50% results ~ by that I mean that if I have turned a layer OFF in the AMW viewer, I can turn it on by using
Code: [Select]
(setviewersetting (strcat "OpenDoc.Layer." "12") "Visible"  "T")
where "12" was the number of the layer I wished to turn ON. But if I run
Code: [Select]
(setviewersetting (strcat "OpenDoc.Layer." "12") "Visible"  "F")
the bugger doesn't turn the layer OFF for some reason, yet when I retrieve the value, it tells me the visibility is False, therefore it should be turned off !
Could you run that code in your baselisp evaluator and tell me if you can successfully turn a layer off (or on) ?
I've tried using setviewersetting / setprovar and a whole host of other things but just can't get that or any other bloody layer to turn off.

(I also have the layer set to NO-plot within Acad but AMW doesn't honour Acad's internal settings)

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
M-dub ~ I need you input here
« Reply #1 on: May 21, 2004, 09:02:44 AM »
Hendie, does the baselisp evaluator recognize typical lisp commands or does it use it's own set of commands?

If so, why not try to manipulate the layer status by simply turning visibility off in the drawing symbol tables by setting the value of the layer's color to a negative number or by applying the freeze bit?
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

hendie

  • Guest
M-dub ~ I need you input here
« Reply #2 on: May 24, 2004, 06:07:46 AM »
thanks for the response Keith.
Nah, AMW uses it's own version of Lisp (Baselisp ~ very basic lisp  :choke: )

The main problem is that my users (in production) need to plot out designs to send to the outsourcers. So, I need to hide the customers name from the outsourcer.
My initial thoughts were "simple ~ put the customers name on it's own layer and put the layer to No-Plot"
which is fine when you plot from Acad, but my users plot from AMW and don't have access to Acad.
AMW has it's own viewer and it recognises Acad layer structure ~ but it doesn't use the Acad plot table. So I thought I would create a custom routine in AMW which hid the customers name prior to plotting and restored it after the plot.

the bit that's pi$$ing me off is that if I manually turn the layer off, I can restore it using the code ...
Code: [Select]
(setviewersetting "OpenDoc.Layer.12" "Visible"  "T")
but when I change "T" to "F" it refuses to turn the layer off, and if I do a check to retrieve the layer status, it tells me that the layer is indeed off... but it blatantly isn't.

AMW has it's own pen table but doesn't allow the turning off of pens.
and since the software is now obsolete and unsupported, I can't go back to Cyco and complain.

it's beginning to look like I'll have to do the plotting for the outsourcer stuff.

hendie

  • Guest
M-dub ~ I need you input here
« Reply #3 on: May 24, 2004, 09:31:19 AM »
Cracked it !... well after a fashion anyway...

I found this Lisp on Cyco's despicable site after some trawling and just in case it may be useful for someone sometime somewhere...
Quote
To load the functions open the BaseLISP evaluator, load the BaseLISP file HydeLaye.lsp and execute it. Now a pulldown menu as displayed is available and from here all functions can be called.

When an AutoCAD drawing is displayed the function “Hide Layers” will display a dialogue with all layers in this AutoCAD drawing. By selecting one of those layers you will register that layer as not displayed for every AutoCAD drawing that is managed by AM-WorkFlow.

The function “Unhide Layers”  will display a dialogue with all layers that are switched off by means of “Hide Layers” and that then can be switched on again.

“List hidden Layers” will display a dialogue with all layers that are switched off.

The layers that should not be displayed are registered in the user profile of the current user <USER>.ABU. The special section is "ViewMan.Vector.AutoCadDwgDxf" and the special key is "HideLayers". The layers that should not be displayed are stored as a string of names separated by a semicolon ( ; ).


So I just logged in as my user, ran the lisp, selected the layer I wanted hidden from them and hit the button ~ note: you have to restart AMW for the changes to take effect.
Now the customers name (layer) is hidden for all drawings, and thus, does not plot for that particular user. The customers name is still visible in the database though if they need it. But that solves my plotting problem.
Further note: make sure you run it in the Baselisp Evaluator, and don't load it through the <your-ENV>.lsp otherwise the user will have full access to the drop down menu.

Now why couldn't they just have put that information in the damn help file ? (I use the term "help file" very loosely !)

Code: [Select]
(setq HideSection "ViewMan.Vector.AutoCadDwgDxf")
(setq HideKey "HideLayers")

;;; REMOVE A LAYERNAME FROM A LIST OF STRINGS
(defun RemoveFromList (String InList / OutList)
(setq OutList '())
(while (length InList)
(if (s/= String (first InList))
(setq OutList (append OutList (list (first InList))))
);end if
(setq InList (rest InList))
);end while
OutList
);end defun

;;; ADD A LAYERNAME TO A LIST OF STRINGS
(defun StrToList (Separator String / OutList SepPos)
(setq OutList '())
(while (and (strlen String) (s/= Separator String))
(if (s= (leftstr String 1) Separator)
(setq String (substr String 2))
);end if
(setq SepPos (strstr String Separator))
(setq OutList (append OutList (list (if SepPos (leftstr String (- SepPos 1)) String))))
(setq String (if SepPos (substr String (+ 1 SepPos)) ""))
);end while
OutList
);end defun

;;; CONVERT A LIST TO A STRING WITH THE ENTRIES SEPERATED BY A SEPERATOR
(defun ListToStr (Separator InList / String)
(setq String "")
(while (> (length InList) 1)
(setq String (strcat String (first InList) Separator))
(setq InList (rest InList))
);end while
(if (length InList)
(setq String (strcat String (first InList)))
);end if
String
);end defun

;;; REQUEST LIST OF HIDDEN LAYERS
(defun GetHiddenLayers ()
(StrToList ";" (getabuvar HideSection HideKey))
);end defun

;;; DISPLAY HIDDEN LAYERS
(defun ListLayers ()
(messagebox "Hidden Layers" (ListToStr "\n" (GetHiddenLayers)) "O" "A")
);end defun

;;; HIDE LAYERS
(defun HideLayers ( / NoLayers Layer Section LayerList Expr)
(setq LayerList '())
;;; Build a list of all present layers
(setq NoLayers (getviewervar "OpenDoc.Layer" "NoLayers"))
(setq Layer 0)
(while (< Layer NoLayers)
(setq Section (strcat "OpenDoc.Layer." Layer))
(setq LayerList (append LayerList (list (getviewervar Section "Name"))))
(setq Layer (+ Layer 1))
);end while
;;; As long as there are layernames in the list
(if (length LayerList)
(progn
;;; Build a dialog to display them
(setq Expr (append
(list 'setqselectbox 'Layer "Hide Layers" "Select a Layer to hide"
(first LayerList) "OC" "Q")
LayerList)
);end setq
;;; Start the dialog and ask which layers should be hidden and store that
;;; value in the user-profile
(if (/= 0 (eval Expr))
(progn
(setq LayerList (StrToList ";" (getabuvar HideSection HideKey)))
(setq LayerList (append LayerList (list Layer)))
(setabuvar HideSection HideKey (ListToStr ";" LayerList))
);end progn
);end if
);end progn
);end if
(refresh)
);end defun

;;; UNHIDE LAYERS
(defun UnhideLayers ( / LayerList Layer Expr)
;;; Request the list with hidden layers from the user-profile
(setq LayerList (GetHiddenLayers))
;;; As long as there are layernames in the list
(if (length LayerList)
(progn
;;; Build a dialog to display them
(setq Expr (append
(list 'setqselectbox 'Layer "Unhide Layers" "Select a Layer to unhide"
(first LayerList) "OC" "Q")
LayerList)
);end setq
;;; Start the dialog and ask which layers should be made unhidden and store the
;;; new value of still hidden layers in the user-profile
(if (/= 0 (eval Expr))
(progn
(setq LayerList (StrToList ";" (getabuvar HideSection HideKey)))
(setq LayerList (RemoveFromList Layer LayerList))
(setabuvar HideSection HideKey (ListToStr ";" LayerList))
);end progn
);end if
);end progn
);end if
(refresh)
);end defun

(defun VIEWDOC ()
(docview "Hidelaye.doc")
)

(mainmenu-delete "AutoCAD La&yer Control")
(mainmenu-add "AutoCAD La&yer Control")
(submenu-add "AutoCAD La&yer Control" "&Hide Layers" 'HideLayers)
(submenu-add "AutoCAD La&yer Control" "&Unhide Layers" 'UnhideLayers)
(submenu-add "AutoCAD La&yer Control" "&List hidden Layers" 'ListLayers)
;(submenu-add "AutoCAD La&yer Control" "Explanation" 'VIEWDOC)

M-dub

  • Guest
M-dub ~ I need you input here
« Reply #4 on: May 27, 2004, 09:33:24 AM »
I'm so sorry, Hendie!   :oops:
I don't venture into this forum too often.  Did you get this figured out?

Again, my apologies!

hendie

  • Guest
M-dub ~ I need you input here
« Reply #5 on: May 27, 2004, 09:49:58 AM »
don't worry Mike, I got it figured out in the end


ya mean you don't use the "view posts since last visit" option ?

M-dub

  • Guest
M-dub ~ I need you input here
« Reply #6 on: May 27, 2004, 10:30:09 AM »
Quote from: hendie
ya mean you don't use the "view posts since last visit" option ?

Very rarely...guess I should use it more often.  :oops: