Author Topic: Embed .LIN File into VLX file  (Read 1942 times)

0 Members and 1 Guest are viewing this topic.

mailmaverick

  • Bull Frog
  • Posts: 493
Embed .LIN File into VLX file
« on: July 09, 2018, 01:38:06 AM »
Hi,

I have few LISP routines which I have compiled into single VLX file which I load every time autocad starts using APPLOAD in AutoCAD.
I have a custom linetype (stored in .LIN file) which I want to embed into my VLX file so that every time my VLX file loads, the custom linetype automatically gets added in my AutoCAD File. While making an Application (File -> Make Application) in VLIDE, I explored various options but couldn't find any place to add .LIN files to the project. How can I achieve this ?

Peter2

  • Swamp Rat
  • Posts: 653
Re: Embed .LIN File into VLX file
« Reply #1 on: July 09, 2018, 02:49:30 AM »
I embed ODCL.lsp-files in my VLX. Here is my PRV and my lisp-snippet, but I don't know if it works for LIN too ..


PRV-example:
Code - Auto/Visual Lisp: [Select]
  1. (PRV-DEF
  2.   (:target . "my_tool.VLX")
  3.   (:active-x . T)
  4.   (:separate-namespace)
  5.   (:protected . T)
  6.   (:load-file-list
  7.     (:lsp
  8.       "S:\\mylisp_a.lsp"
  9.     )
  10.     (:lsp
  11.       "S:\\mylisp_b.lsp"
  12.     )
  13.   )
  14.   (:require-file-list
  15.     (:txt
  16.       "S:\\my_dialogue_a.odcl.lsp"
  17.     )
  18.     (:txt
  19.       "S:\\my_dialogue_b.odcl.lsp"
  20.     )
  21.   )
  22.   (:ob-directory)
  23.   (:tmp-directory)
  24.   (:optimization . st)
  25. )
  26. ;; EOF
  27.  


Lisp-snippet:
Code - Auto/Visual Lisp: [Select]
  1. ; ********** ODCL auslesen **********
  2. (defun _Load_ODCL_Embedded_Project ( projname password alias / bytes rtype )
  3.  
  4.         ;;  Versuche das eingebetete OpenDCL-Projekt als Lisp-Quelle aus der Textquelle
  5.         ;;  der aktuellen VLX auszulesen. War dies erfolgreich, muss das Projekt mit der
  6.         ;;  Funktion dcl_project_import geladen und der Rückgabewert an die aufrufende
  7.         ;;  Funktion übergeben werden
  8.         (cond
  9.             ;;  Prüfe den Zugriff auf die Projektdaten innerhalb der Textquelle in der
  10.             ;;  VLX und gebe eine Meldung aus, wenn dies fehlgeschalgen ist
  11.             (     (or
  12.                     (null (setq bytes (vl-get-resource projname)))
  13.                     (not (eq 'str (setq rtype (type bytes))))
  14.                     (eq "" bytes)
  15.                 )
  16.  
  17.                 (princ (strcat "\nKann die Quell für das OpenDCL-Projekt <" projname "> nicht aus der VLX-Datei laden.\n"))
  18.                 nil
  19.             )
  20.  
  21.             ;;  Mit dcl_project_load wird das Projekt geladen und der Rückgabewert
  22.             ;;  an die aufrufende Funktion übergeben, wenn der Vorgang erfolgreich war.
  23.             (  
  24.                 (dcl-project-import bytes password alias)  
  25.             )
  26.         )
  27. )
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

BIGAL

  • Swamp Rat
  • Posts: 1417
  • 40 + years of using Autocad
Re: Embed .LIN File into VLX file
« Reply #2 on: July 09, 2018, 07:12:41 AM »
You could write the .lin from the VLX and loadlinetype but it may expose the linetype then to be copied from this dwg..
A man who never made a mistake never made anything

CincyJeff

  • Newt
  • Posts: 89
Re: Embed .LIN File into VLX file
« Reply #3 on: July 09, 2018, 11:55:12 AM »
I always add custom definitions into the acad.lin file so they are always available. Is this a possible option?

Crank

  • Water Moccasin
  • Posts: 1503
Re: Embed .LIN File into VLX file
« Reply #4 on: July 09, 2018, 02:44:56 PM »
As long as you don't use complex linetypes, it's easy to create your own:
Code - Auto/Visual Lisp: [Select]
  1. (defun entmakeLT (naam omschrijving parameters)
  2.         (entmake
  3.                 (append
  4.                         (list   '(0 . "LTYPE")
  5.                                         '(100 . "AcDbSymbolTableRecord")
  6.                                         '(100 . "AcDbLinetypeTableRecord")
  7.                                         (cons 2 naam)
  8.                                         '(70 . 0)
  9.                                         (cons 3 omschrijving)
  10.                                         (cons 72 (ascii (nth 0 parameters)))
  11.                                         (cons 73 (1- (length parameters)))
  12.                                         (cons 40 (apply '+ (mapcar 'abs (cdr parameters))))
  13.                         )
  14.                         (apply 'append
  15.                                 (mapcar '(lambda (x) (list (cons 49 x) '(74 . 0)))
  16.                                         (cdr parameters)
  17.                                 )
  18.                         )
  19.                 )
  20.         )
  21. )
  22. ; Voorbeeld:
  23. (entmakeLT "LINETEST" "My own linetype!" '("A" 25.4 -6.35 12.7 -6.35))
Vault Professional 2023     +     AEC Collection

d2010

  • Bull Frog
  • Posts: 326
Re: Embed .LIN File into VLX file
« Reply #5 on: July 09, 2018, 02:48:20 PM »
Please, you upload the file my_tool.lin.
My tool Riptoff1991.exe transform "my_tool.lin" to  "my_tool.lsp"
I can try, convert  "my_tool.lin" to "my_tool.lsp"
You run "my_tool.lsp" , and you got the lines inside drawing.dwg.
Best Regards
.
 :|

Hi,
I have few LISP routines which I have compiled into single VLX file which