Author Topic: a Suggestion  (Read 37877 times)

0 Members and 1 Guest are viewing this topic.

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: a Suggestion
« Reply #15 on: July 12, 2006, 09:35:47 PM »
Is Tony's code open to see how variables are being passed back and forth?
If so, could someone decipher it for me as I'm severely lisp challenged :).
If you know how to get data back and forth, controlling focus can be controlled (by passing other data say).

Luis cut his teeth in arx passing lisp var's back and forth, the big help there though was that arx gives you a 'signature' prefix to add to functions that you wish to do this with, this was 'ads_*****'. Perhaps it can be done with .net as well??
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: a Suggestion
« Reply #16 on: July 13, 2006, 07:35:46 AM »
James,

1 & 2) Correct, except to run a form from lisp I use:

Code: [Select]
(defun c:jbkeynotesdialog  (/ kfile)
  (if (and (setq kfile (jb:GetKeynoteFile nil)) (findfile "jbForms.dvb"))
    (progn
      (setq jb%KeyFile kfile)
      (vl-vbarun "jbForms.dvb!FormControl.jbKeyNotesForm")
      ))
  (princ)
  (princ))

In the above example I'm also setting 'jb%KeyFile to a string of a file for the VBA form to open and read:

Code: [Select]
Public Sub jbKeyNotesFormRefresh()
KeyNotes.ListBox2.Clear
On Error GoTo ErrMessage
Dim file As String, str As String

file = GetLispVar("jb%KeyFile")

If Not file = "" Then
Open file For Input As #1
Do While Not EOF(1)
    Input #1, str
    KeyNotes.ListBox2.AddItem (str)
Loop
Close #1
    End If
ErrMessage:
    Close #1
    Exit Sub
End Sub

3) A double click event from the same form sets a lisp variable and then fires a lisp function:

Code: [Select]
Private Sub ListBox2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim str As String
Dim index As Integer
index = ListBox2.ListIndex

Me.AcFocusCtrl1.KeepFocus = False

If index > -1 Then
str = ListBox2.List(ListBox2.ListIndex)
SetLispVar "jb%KeyInfo", str
EvalLispExpression ("(jbPlaceKeynote)")
End If
End Sub

4) Note the "Me.AcFocusCtrl1.KeepFocus = False" call in the sub above - this is a modeless form, it's a keynoting routine.  There is an activeX control "AcFocus" floating around that maintains the focus on a modeless form.  It's a bit trickey but switching focus can be done.

5) yes

6)  What I do is set up Sub functions in a module that only deal with the controls I want updated.  You could just run the initialize method, but if you have a big form, or only want to update parts then break it up into different subs.  The following is from a modeless, no titlebar, rolled-up, transparent form that handles two differnt routines in a multi-page control (tabs):

Code: [Select]
Public Sub ViewInit()
jbToolPalette.VListBox.Clear
Dim viewname As String
Dim view As AcadView
For Each entry In ThisDrawing.Views
jbToolPalette.VListBox.AddItem entry.Name
Next
End Sub

From lisp this would be called as:

Code: [Select]
(vl-vbarun "jbForms.dvb!FormControl.ViewInit")
This sub is actually called from a Document Event sub (reactor) 'CommandEnded for when the user edits views with the AutoCAD -view and view commands:  (In the "ThisDrawing" module)

Code: [Select]
Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
If CommandName Like "-VIEW" Then
FormControl.ViewInit
End If
If CommandName Like "VIEW" Then
FormControl.ViewInit
End If
If CommandName Like "XREF" Then
FormControl.LSInit
End If
End Sub

For the ObjectDCL equivelent of 'OnDocument_Activated I just use another Document Event sub:

Code: [Select]
Private Sub AcadDocument_Activate()
    FormControl.ViewInit
    FormControl.LSInit
    FormControl.jbKeyNotesFormRefresh
    FormControl.editLSInit
End Sub

And finally, a moment of zen:
Rolled Up -



Just pick a tab:





Notice the scroller at the bottom for adjusting transparency?

Hope this helps.

jb
James Buzbee
Windows 8

LE

  • Guest
Re: a Suggestion
« Reply #17 on: July 13, 2006, 11:10:46 AM »
Luis cut his teeth in arx passing lisp var's back and forth,

 :-)

Do not know, but I am going to use a new word I learn here (@theSwamp) "party pooper"... Why not moving/learning/etc.... into a much powerful programming language?.... why keeping the idea of mix lisp-vba ?

Many are going the C# route, others ObjectARX, and the C++ foundation in there..... Why not all the effort you guys are doing into trying to come up with a mixer or workarounds, put it into a more profitable programming future and how about the ones that work doing programming for living, it will give you more power and foundation for your self.....

The Visual Studio Pro Edition is just 800 dollars and an update 550 plus minus..... a worth spent.

C++/MFC/WinApi/ARX/C# are not to difficult - appears to be, it is required dedication, reading, a lot of research work, but I bet it is the same time spent to learn any other language.......... We have here some of our members experienced with those languages (as always) willing to answer any question(s).....

Just my own personal point of view (sorry).

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: a Suggestion
« Reply #18 on: July 13, 2006, 12:53:39 PM »
James, Very nice results. Keep up the good work.

Luis
I think this was an effort to keep using LISP & make up for the loss of ObjectDCL.
Can NET be used to create the dialogs needed AND communicate with lisp?
Forgive my ignorance if this is a silly question.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

LE

  • Guest
Re: a Suggestion
« Reply #19 on: July 13, 2006, 01:05:28 PM »
I think this was an effort to keep using LISP & make up for the loss of ObjectDCL.

Yep I know that Alan; I was an user of ObjectDCL... I have a license of the product, now abandoned....

Quote
Can NET be used to create the dialogs needed AND communicate with lisp?

Yes.... as the same you can do with ARX (and it is seriously EASY)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: a Suggestion
« Reply #20 on: July 13, 2006, 01:12:17 PM »
Is NET version dependent like VBA is? That is do you have to recompile for each ACAD version?
What does NET produce a dll or do you compile on-the-fly like lisp?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

LE

  • Guest
Re: a Suggestion
« Reply #21 on: July 13, 2006, 01:17:21 PM »
I can say only about ObjectARX (that's what I use now) it is per Acad version... (I have my VS2005 & A2007 still on the box) so, about the .NET (C#) I'll wait for someone that really knows to answer that....

TR

  • Guest
Re: a Suggestion
« Reply #22 on: July 13, 2006, 01:43:03 PM »
Is NET version dependent like VBA is? That is do you have to recompile for each ACAD version?
What does NET produce a dll or do you compile on-the-fly like lisp?

1) .NET is version dependent.

2) .NET produces a dll which you load via the NETLOAD command or via the system registry.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: a Suggestion
« Reply #23 on: July 13, 2006, 01:54:43 PM »
Luis, I hear what your saying and I agree, however:

I'm up and running in VBA in about 2 weeks.  Could I be as proficient in C++ in that time?  I doubt it.

Don't get me wrong - for AutoCAD that's the only way to go - and by getting some exposure to VBA my mind is already developing to the point that I think another language would be easier.  However, this is the only slowdown in work I can see us having for the next 3 years which is why I decided to abandoned ODCL and develope VBA forms.   Heck, by that time we'll probably all be using Revit!

jb
James Buzbee
Windows 8

LE

  • Guest
Re: a Suggestion
« Reply #24 on: July 13, 2006, 02:20:47 PM »
Luis, I hear what your saying and I agree, however:

I'm up and running in VBA in about 2 weeks.  Could I be as proficient in C++ in that time?  I doubt it.

Don't get me wrong - for AutoCAD that's the only way to go - and by getting some exposure to VBA my mind is already developing to the point that I think another language would be easier.  However, this is the only slowdown in work I can see us having for the next 3 years which is why I decided to abandoned ODCL and develope VBA forms.   Heck, by that time we'll probably all be using Revit!

jb

Well.... at least I tried....... no problem.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: a Suggestion
« Reply #25 on: July 13, 2006, 03:55:22 PM »
Luis, please don't be offended!  I'd love to learn C++.  I'm a designer however, not a programmer.  I started all this stuff to "sharpen" my tool of choice: AutoCAD.  If I ever get the luxery of time to start you can bet I'll look to you, and this site, for help!

 ;-)

jb
James Buzbee
Windows 8

LE

  • Guest
Re: a Suggestion
« Reply #26 on: July 13, 2006, 04:07:35 PM »
Jim;

I lately just write and try learn new languages simple for the fan of it, and to keep my few cells left busy, that's the main reason I kept doing programming.... and at the same time (as you and many others) found this great site, where I can learn/share/spent a lot of my free time.....  (and no I am not offended at all  :-))

ps... I do (as maybe you) architectural work for living....


Take care.


MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: a Suggestion
« Reply #27 on: July 13, 2006, 06:51:48 PM »
The reason I ask and suggest .net is how long will AutoCAD support vba now that .net is available??
While .net app's are version dependent the amount of re work to update would be negligable, winforms will be doing the grunt work, you won't be using the .net arx/Interop much if at all. In fact, you could create an visual editor and all sorts of goodies which would/may not be possible with vba.

food for thought!
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: a Suggestion
« Reply #28 on: July 13, 2006, 09:11:08 PM »
The reason I ask and suggest .net is how long will AutoCAD support vba now that .net is available??
.....   food for thought!


Without a crystal ball it's anyone's guess ... but that is one of the reasons I won't be putting any effort into VBA development.
The Office suites now use Visual Studio for apps .. if thats any indicator.

The next couple of years will be interesting, to say the least.

James, I think I may have said this previously, but in case I only thought it, I think the project you have initiated is a great idea and full credit to you.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: a Suggestion
« Reply #29 on: July 13, 2006, 09:22:50 PM »
...

James, I think I may have said this previously, but in case I only thought it, I think the project you have initiated is a great idea and full credit to you.


ditto that.

I think there are 2 important points that have/will come out of all this.
1) If you do any type of programming, don't get too dependent on any lib's UNLESS you know how to work without them!
2) There is always another way to get something done, while building a vba alternative is the path of least resistance - at this time - I think a good alternative is to create and interface between lisp and whatever and thus enabling you do do your UI in the language of your choice. This is what .net is all about.

Would I be correct in assuming that data is being passed back and forth using a xdictionary record? If so is this efficient enough? If not would it be a good idea??
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien