TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: daron on September 23, 2003, 05:31:55 PM

Title: type libraries
Post by: daron on September 23, 2003, 05:31:55 PM
Is it possible to take the functions we have made and put them in a type library, so when writing new routines that use these they'll turn blue, or whatever color your built in functions turn when you type them out?
Title: type libraries
Post by: JohnK on September 23, 2003, 07:39:51 PM
In the VLIDE? I seriously doubt it. In any other text editor, yes.
Title: type libraries
Post by: daron on September 24, 2003, 11:37:40 AM
Okay, so how would you create one? I'd like to try it in the vlide after one is created. I would assume it's like any other tlb. As soon as it's imported, it should work. I did the funniest thing yesterday that made me think of it. I did this (vlax-import-type-library :tlb-filename "axdb15") and it turned things like Item and Freeze and ActiveDocument, blue. I didn't need to put vla in front of them at all. Not what I expected, but it re-spawned an old idea.
Title: type libraries
Post by: JohnK on September 24, 2003, 12:30:07 PM
Dude your nuts! I havent the slightest idea how to create a type lib. Well i supose you could create it in VB6 but i dont know how.  (Ill see if i can find any info for ya)

...I swear, one of these days im going to help you set up VIM. (A better text editor. Youll never look back.) Everything is a text file and quick as shit. Any functions i want added, all i have to do is add those function names to a file and VIM colors them for me.  (in any color i want.)
Title: type libraries
Post by: Kerry B on September 25, 2003, 06:31:42 PM
for Sybbol protection & colouring in the VL IDE you could use something like this :-

Code: [Select]

;;;-----------------------------------------------------------------------------------
;;;-----------------------------------------------------------------------------------
(vl-load-com)
(setq *temp-symbols* '(kpsl_savesysvar kpsl_on_error
      kpsl_ptos kpsl_dtr
      kpsl_rtd kpsl_deflection
      kpsl_midpoint kpsl_getpoint
      kpsl_getint kpsl_entsel
      c:testarcdim
     )
)
(eval (list 'pragma
   (list 'quote (list (cons 'unprotect-assign *temp-symbols*)))
      )
)
;;;-----------------------------------------------------------------------------------
;;;-----------------------------------------------------------------------------------
;; add the defuns here < snip >

;;;-----------------------------------------------------------------------------------
;;;-----------------------------------------------------------------------------------
(eval
  (list 'pragma (list 'quote (list (cons 'protect-assign *temp-symbols*))))
)
(setq *temp-symbols* nil)


Title: type libraries
Post by: daron on September 25, 2003, 06:56:46 PM
Kerry, could you help me set this up? I have no idea what pragma is and what should be in the *temp-symbols* list and the add defuns here? In what way should I add them?
(nameofdefun) or do I need to wrap each function in this whole thing or what?
Title: type libraries
Post by: JohnK on September 26, 2003, 08:29:51 AM
Joe? Is that you?
Title: type libraries
Post by: smadsen on September 26, 2003, 03:24:12 PM
Think Kerry meant adding defuns like this:
Code: [Select]
(vl-load-com)
(setq *temp-symbols* '(kpsl_savesysvar   kpsl_on_error     kpsl_ptos
                       kpsl_dtr          kpsl_rtd          kpsl_deflection
                       kpsl_midpoint     kpsl_getpoint     kpsl_getint
                       kpsl_entsel       c:testarcdim
                      )
)
(eval (list 'pragma
            (list 'quote (list (cons 'unprotect-assign *temp-symbols*)))
      )
)
;;;-----------------------------------------------------------------------------------
;;;-----------------------------------------------------------------------------------
;; add the defuns here < snip >

(defun kpsl_dtr (a)
  (* (/ a 180.0) pi)
)

(defun kpsl_midpoint (p1 p2)
  (princ "OK, so this is not Kerry's midpoint function")
  (princ)
)

;;; etc....

;;;-----------------------------------------------------------------------------------
;;;-----------------------------------------------------------------------------------
(eval
  (list 'pragma (list 'quote (list (cons 'protect-assign *temp-symbols*))))
)
(setq *temp-symbols* nil)
Title: type libraries
Post by: daron on September 26, 2003, 04:35:44 PM
Thanks, Stig. I think I understand now.
Title: type libraries
Post by: JohnK on September 26, 2003, 05:12:44 PM
Man you guys got me confused. Where do you add that to. As a file in your suport file search path? In the acad doc lisp?
Title: type libraries
Post by: daron on September 26, 2003, 05:25:39 PM
I see it as being wrapped around your functions. I haven't had a chance to try it, yet, so I don't know if it is what I am looking for, but I think it is. What'd you get?
Title: type libraries
Post by: JohnK on September 26, 2003, 05:32:50 PM
I didnt try it yet cause i dont know what to do with it.  lol
Title: type libraries
Post by: Anonymous on October 20, 2003, 06:32:44 AM
Hi John,

I had forgotten about this guest post, time flies ..

Did you get this sorted .. ??

If you like I can do a short tutor on how to make this work ..
it wont be this week though, as I have a course to attend and my spare time will be zip, nada, zilch.
Title: type libraries
Post by: Kerry on October 20, 2003, 06:34:44 AM
Who was that masked man ??

Regards
Kerrry




Note to self. login, login, login
Title: type libraries
Post by: daron on November 11, 2003, 11:43:05 AM
Just in case anybody's wondering about this. I just tried it, finally, and Stig's reply is correct. Thanks, guys.
Title: type libraries
Post by: daron on November 11, 2003, 12:15:18 PM
Kerry, now that I've got this working, do you or anybody else know of a way to change the color of user defined functions?
Title: type libraries
Post by: Kerry on November 11, 2003, 02:30:41 PM
No : ...
Only from the VLisp IDE < for ALL symbols
Tools -> Window Attributes -> Configure Current
then Select LEX-SYM from the combo & set the color
Title: type libraries
Post by: daron on November 11, 2003, 02:35:54 PM
Yeah, I knew about that. Thanks, though.