Author Topic: populating a listbox  (Read 7019 times)

0 Members and 1 Guest are viewing this topic.

realmseeker

  • Guest
populating a listbox
« on: March 19, 2013, 08:11:56 AM »
Good day,

I am new to lisp and opendcl so please bear with me.  Also I am a cabinet maker, not a programmer.

I started in the opendcl forums, and they also directed me here.(http://www.opendcl.com/forum/index.php?topic=1951.0)

Basically I am trying to make a palette that will help me export a Dwg or Dxf from autocad to another program(Biesseworks).  Biesseworks has an importer, but I need to bring points in as parametric.  The output can be a txt file, so I am not to worried about creating that half just yet.

Where I am stuck atm is that I have a combobox that selects all the layers.  I need to populate a listbox with all entities on said layer.  Also I am realizing two things(other then my complete lack of knowledge of ActiveX and Lisp):

- I have to figure out to either use a listbox with checkboxes in it, or as you can see from my ODCL I will upload, use radio buttons on the side.  I am guessing I would have to generate a variable or attach a custom dxf code onto each entity and work with that.  The output will just be a  text file that has the points written as parametric, biesseworks can figure itself out from there.

- LWpolylines and polylines don't seem to report as individual entities, so I need a way to grab each start and end point in them, and either centres or radius of curves.  I am fairly certain that this can be done with an If statement concerning entity types.

So step one atm is to just get the listbox populate and worry about the rest as each piece comes up.  I can't get it to do that.  I can get either a list to generate of names, but not be strings, or as I have it right now, well it isn't much...

Hope not to noob for these forums, thanks :)

Jordan



roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: populating a listbox
« Reply #1 on: March 20, 2013, 05:14:36 PM »
Jordan, I think your approach is wrong:
1.
You have skipped the Lisp basics and are jumping in at the deep end.
2.
You are working on the GUI first when you should be focussing on the code that will do the translating.

I am not sure how your GUI can work. You want to show a list of strings representing entities on a layer. What is the user going to do with a list with (for example) multiple 'AcDbPolyline' entries?

Attached is a revised BWPC.LSP.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: populating a listbox
« Reply #2 on: March 21, 2013, 05:53:44 AM »
You should check out:
http://www.theswamp.org/index.php?topic=44210.0
And other posts by S.Langhammer.
He is also working on a custom export format.

realmseeker

  • Guest
Re: populating a listbox
« Reply #3 on: March 21, 2013, 04:05:52 PM »
Thanks for the rewrite and info Roy :)

I went through Jeff Sanders tutorials ( http://www.jefferypsanders.com/autolisptut.html )  and thought I got the basic idea of lisp.  Unfortunately there doesn't seem to be much out there for ActiveX.  Wish there was something like Code Academy for this stuff (http://www.codecademy.com).

Ill go through the link you posted.

realmseeker

  • Guest
Re: populating a listbox
« Reply #4 on: March 21, 2013, 04:43:25 PM »
Quick question Roy:

Your NewLst variable creates a list, but the elements aren't strings, how is the Listbox reading them?  I thought they had to be in quotes as strings?

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: populating a listbox
« Reply #5 on: March 21, 2013, 05:13:00 PM »
but the elements aren't strings
Actually they are. The (vla-get-objectname) function returns a string.
You can easily test this yourself by inserting this code (in the right place):
Code - Auto/Visual Lisp: [Select]
  1. (print newLst)
  2. (print (type (car newLst)))

You are right that info on Visual Lisp is a little harder to find.
This may be a useful link for you:
http://www.afralisp.net/index.php

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: populating a listbox
« Reply #6 on: March 21, 2013, 05:17:38 PM »
Although I don't know where you are heading with your program or your GUI, chances are that the newLst variable will have to become a list-of-lists instead of a list-of-strings. And you will most likely have to use a more complex OpenDCL control (grid).