Author Topic: Add support path  (Read 4848 times)

Lube

  • Member
  • *
  • Posts: 25
Add support path
« on: August 19, 2015, 07:59:45 AM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 3059
    • Outside The Box
Re: Add support path
« Reply #1 on: August 19, 2015, 07:38:59 PM »
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.

Fred Tomke

  • OpenDCL Technician
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2070
  • [ Mr. Bad Guy ]
    • Kommunale Entwicklungsplanung auf digitaler Basis - digital landscape and urban design
Re: Add support path
« Reply #2 on: August 19, 2015, 09:30:43 PM »
Hi, Lube,

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

Code: [Select]
[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

  • Member
  • *
  • Posts: 25
Re: Add support path
« Reply #3 on: August 20, 2015, 01:26:27 AM »
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

  • OpenDCL Technician
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2070
  • [ Mr. Bad Guy ]
    • Kommunale Entwicklungsplanung auf digitaler Basis - digital landscape and urban design
Re: Add support path
« Reply #4 on: August 20, 2015, 02:47:29 AM »
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

  • Member
  • *
  • Posts: 25
Re: Add support path
« Reply #5 on: August 20, 2015, 02:56:11 AM »
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

  • OpenDCL Technician
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2070
  • [ Mr. Bad Guy ]
    • Kommunale Entwicklungsplanung auf digitaler Basis - digital landscape and urban design
Re: Add support path
« Reply #6 on: August 20, 2015, 03:44:31 AM »
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

  • Member
  • *
  • Posts: 25
Re: Add support path
« Reply #7 on: August 20, 2015, 07:00:04 AM »
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

  • OpenDCL Technician
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2070
  • [ Mr. Bad Guy ]
    • Kommunale Entwicklungsplanung auf digitaler Basis - digital landscape and urban design
Re: Add support path
« Reply #8 on: August 21, 2015, 12:01:30 AM »
Hi, google for AutoCAD and menu
for instance: http://www.archidigm.com/Coverpage/cover1-01/lounge-set_menu.htm
Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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