Author Topic: Check Costom .lin for linetype  (Read 2209 times)

0 Members and 1 Guest are viewing this topic.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Check Costom .lin for linetype
« on: July 19, 2005, 01:13:36 PM »
I want to load a linetype from a costom .lin file, but how do I check the .lin file for that linetype before loading it (I want to be certian that it is there).

If it not found then I want to load a linetype from a known .lin file.

What I have is psuedo code so far. What is known is the name of the linetype and the .lin file (minus the ext)

Check to see if the lin file is in the search path:
(findfile "linfile")

Check the .lin file for linetype:
THIS IS WHERE I'M LOST

If linetype exsists
load it
load NOLINE from known lin file

Maybe someone in here can give me a push, I haven't coded anything in about a month (life keeps getting in the way) :roll:

Thanks guys
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Check Costom .lin for linetype
« Reply #1 on: July 19, 2005, 03:56:19 PM »
I've run out of time to explain so I'll just hand it over ..
Code: [Select]

(defun checkLin (/ lin_file lin_file_open line answer)
 
; .lin file
  (setq lin_file "C:\\Temp\\acad.lin"
lin_file_open (open lin_file "r")
  )

  (while (setq line (read-line lin_file_open))
    (if (wcmatch line "`*HIDDEN*")
      (progn (setq line nil answer T))
    )
  )

  (close lin_file_open)

  answer

)
;;; run this from your main function
(if (checklin) (alert "found it!!"))
TheSwamp.org  (serving the CAD community since 2003)

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Check Costom .lin for linetype
« Reply #2 on: July 19, 2005, 10:16:03 PM »
I thought of that route, but I couldn't get it to work correctly.

This is for  the Layer Creator, so you could essentially run through this file for every layer inserted.  Do you think there would be a speed isuue from accessing the .lin file about 30 times (1 after the other) checking for a certian linetype? Would it be faster to save the entire file in a variable then check against that?

You could also acces 30 differant file on every insert?

Just triing to find the best way (fastest)

Thanks Mark
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

SMadsen

  • Guest
Check Costom .lin for linetype
« Reply #3 on: July 20, 2005, 06:47:44 AM »
I've found the easiest way is to use the Load method (ActiveX) with a VL-CATCH-ALL-APPLY call.
If getting an error, you can check if it's a "Undefined linetype" error .. if so, the linetype isn't found in the specified file.