Add support path

Started by Lube, August 19, 2015, 07:59:45 AM

Previous topic - Next topic

Lube

Hello again, I'm looking for a way to add a support path to autocad without the user have to do it manually.

OpenDCL do it because I can see the path for his exemple.

any advice?

Thanks

owenwengerd

You should only extend the user's support path in exceptional circumstances where there is no alternative. Better to specify absolute paths in your code. If you must extend the support path, you can do it when your application first loads.
Owen Wengerd (Outside The Box) / ManuSoft

Fred Tomke

Hi, Lube,

during the installation I added a path in the registry where the user has installed the application in.

[Registry]
Root: HKLM; Subkey: Software\Allevo\Flamap-Update; ValueType: string; ValueName: InstDir; ValueData: {app}


Then I only searched within folders within the install path.

To modify AutoCAD preferences you have to check the AutoCAD preferences ActiveX-object.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Lube

Hello guys, thanks for the reply.
I added a code  in the "code" section that modify the acad20xx.lsp file.

Code (autolisp) Select
(DEFUN AddSupportPath (dir / tmp Cpath)
  (VL-LOAD-COM)
  (SETQ Cpath (GETENV "ACAD") tmp (STRCAT ";" dir ";"))
  (IF (NOT (VL-STRING-SEARCH dir cpath)) (SETENV "ACAD" (STRCAT Cpath ";" dir)))
  (PRINC)
)
(AddSupportPath "C:\\Cobiax\\")


question 1: with absolute path i don't need support path? maybe i don't get what do you mean with that.
     My app installs in C:\COBIAX\Cordoli.
     In this location there is my vlx.
     Inside this folder there is a folder called Blocks with all the block i need to insert inside the dwg.

    In my code i refer to C:\COBIAX\Blocks\cordoli.dwg etc.
    Cause i force the user to install my program in this folder.
   
   Can I do it in another way and avoid cahnge the acad20xx.lsp file?

question 2: is it possible to add to autostart lisp programms from "APPLOAD" ? How?

Thanks :)


Fred Tomke

Hi, I solved that using an mnl-file. Once the user has added the menu, the mnl is automatically loaded. In the file I called (vl-load-all myprogram.vlx).

Finding path of fixed blocks (publish by you product) is only writing an extension:
Code (autolisp) Select

(defun get_block_path (block)
  (setq prefix (vl-registry-read productkey "InstDir"))
  (strcat prefix block)
); get_block_path

(place_block (get_block_path "/Blocks/Geographic/Landmark.dwg"))
(place_block (get_block_path "/Blocks/Survey/WallBolt.dwg"))



HTH, Fred
Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Lube

Thanks Fred :)

can you explain a bit deeper about mnl-file? It's totally new for me.
My program has modal and modeless dialogs only.

What do you mean with "the user has added the menu" ?
In my mind the user should only install the program and when he starts autocad he will find the program totally working without doing anything.

Thanks :)

Fred Tomke

Hello,

mnl file is a lisp file (https://www.google.de/search?q=autocad+lisp+mnl).
This is the content:
Code (autolisp) Select
(if (not vlax-get-acad-object) (vl-load-com))
(defun c:myproduct_load (/ strFile strPath strRegPath)
  (if (not c:myproduct)
    (progn
      (if (not (= (getenv "PROCESSOR_ARCHITECTURE") "x86"))
(setq strReg "SOFTWARE\\Wow6432Node\\Company\\MyProduct")
(setq strReg "SOFTWARE\\Company\\MyProduct")
      ); if
      (if (setq strRegPath (vl-registry-read (strcat "HKEY_LOCAL_MACHINE\\" strReg) "InstDir"))
(if (= (substr strRegPath (strlen strRegPath)) "\\")
  (setq strPath strRegPath)
  (setq strPath (strcat strRegPath "\\"))
); if
(progn
  (princ "\nEin wichtiger Registrierungsschlüssel fehlt. Bitte installieren Sie MyProduct neu!\n")
  (setq strPath "C:\\Programme\\Company\\MyProduct\\")
); progn
      ); if
      (if (setq strFile (findfile (strcat strPath "myproduct.vlx")))
(vl-load-all strFile)
        (alert "\nIch kann die Datei myproduct.VLX nicht finden. Bitte installieren Sie MyProduct neu!\n")
      ); if
    ); progn
  ); if
  (princ)
); c:myproduct_load
(c:myproduct_load)


The image shows the content of the install folder.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Lube

Fred I still need some help!

I was looking how to create a menu with .mnu files.
That's exactly what i need but i don't know how to run lisp code when an item is pressed.


Code (autolisp) Select
***MENUGROUP=Cordoli

***POP1
P1-1[Cordoli]
P1-2[&Load APP]
P1-3[&Help]


Than i need a way to load it via acaddoc.lsp

Maybe this way?
Code (autolisp) Select
(vl-load-com)
(setq *mgs* (vla-get-menugroups (vlax-get-acad-object)))
(vla-load *mgs* "cordoli")


Thanks!

Fred Tomke

Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]