I've spent the last week and a half creating blocks that have between 2 and 10 visibility states in order to represent the separate iterations of common valves.
I would like to construct a lsp and dcl (we work off of a network drive that would enable a stable location for an accompanying dcl file along with the base lsp, though I believe that in order to do what I'm wanting done some on-the-fly dcl manipulation may be necessary) that would display the current drawings in our dynamic block folder and upon selection within the first List_box, would display the different options for visibility states for the block in the 2nd list_box. After a user selects one of the visibility iterations that are now displayed in the 2nd list, an image preview (or slide, I can handle creating the different slides for each block once if required) of how the block will be displayed in the selected visibility state would be shown in what would be the 3rd space, this time an image preview and not a list_box, though I would like porportionality between the list_boxs and the image preview. Some white space is allowable in the list_boxes.
Any suggestions would be greatly appreciated.
I'm not even sure if this would be possible, but I'm assuming you can access the different visibility states in the same manner that you could access polyline verticies or block definition attributes.
Thanks and cheers coders, cheers
I've done some research, and alot of browsing in order to find some bits and pieces to bolt together in order to accomplish the task outlined in the above post.
The closest routines are from the following:
block rename routine created by irneb with the use of opendcl, has a single list box which previews quite well, even getting the text entites within any blocks in the drawing. Only thing that worries me is the usage of opendcl as not many users have those modules. That said, this is some great work from irneb (as per usual) and the dcl interface has a very streamlined look that makes me want to use it!!
LeeMac's block preview routine using regular dcl, no 3rd party software required. This one works well as every by the master does. Because of the fact that he had to write code that draws vector images in order to do the previews, all of the text within blocks is omitted, and this will restrict what usage we could get from this in regards to some of our stamps and text-with-a-border blocks (notes, etc)
Either one of these are very close to what I'm hoping to accomplish and I'm hoping someone who feels that they would be able to handle the code requirements would be able to give me pointers in what to do.
I know the dynamic block visibility states can be managed in visual lisp with the "getdynamicblockproperties" method, and Lee Mac has shown how to set the visibility state of a block with the function at the bottom of this page, which is from his own website:
So, does anyone feel they'd know how to have a list_box send information to the preview pane in order to represent the different visibility states as a user selects them in the list_box? I don't want to have this done for me- just a guru who can help me trudge my way through it.....
Please and cheers
p.s. i can attach a dynamic block upon request
Gears turning, irons in the fire!
Making progress. I've been successful in having a list box in dcl show a preview of the selected item from the list_box. Thanks Lee Mac yet again. So from here what I'll need to do is add another dcl list_box, that populates the existing one based upon the dynamic block that is selected.
The vla methods spoken of just above here can retrieve the properties and visibility states but how to incorporate them into a dcl is much over my head. I will continue trying though, if anyone knows how to do this please inform
Keep the contents of what you want to display in lists, then put the contents of the respective lists into the listbox DCL item. When you need to see what is current in the listbox, use the selected index of the listbox as an index against the original list.
Okay So data into lists:
(setq myList '(("_PRESSURE_REDUCING_REGULATOR" ("Pressure_Reducing_Regulator" "Pressure_Reducing_Regulator_w_External_Tap" "Flgd_Pressure_Reducing_Regulator")) ("_VALVES_withBLEED_VALVES" ("Ball_Valve_w_Bleed_Valve" "Gate_Valve_w_Bleed_Valve" "Flgd_Ball_Valve_w_Bleed_Valve" "Flgd_Gate_Valve_w_Bleed_Valve" "Flgd_Gate_Valve_w_Bleed_Valve_Piston_Act" "Gate_Valve_w_Bleed_Valve_Piston_Act"))
Contents into dcl item :
(mapcar 'add_list (mapcar 'car myList))
(setq subitems (populate_list "listbox1" 0 myList '("editbox")))
(action_tile "listbox1" "(setq subitems (populate_list \"listbox2\" (atoi $value) myList '(\"editbox\")))")
;; define callback to populate "editbox" and save current ;; choice in order to return it
(action_tile "listbox2" "(set_tile \"editbox\" (setq item (nth (atoi $value) subitems)))")
The usage of $Value is for the indexes as far as I know but my list_boxes are not populating.
I'll attach my lisp file as a text file (snippets from BIGAL, DOEY, LEE MAC)
Thank you dgorsman
I am getting close!
I have constructed the list_boxes and the preview pane with the list_boxes populating eachother at least somewhat correctly. Cheers!
So now the only two things left to do are:
1) Find a way to have the FIRST list box populated from all of the dynamic blocks in a specified folder
2) have the preview pane be able to show the different vis states for each of these blocks.
Any tips would be *greatly* appreciated, I've spent some hours on this and if not for the wealth of information on the nets, wouldn't have even came close to getting this far.
Unfortunately, I haven't been able to locate anyone doing specifically this, or more generally list_boxes to show dynamic block vis states. Probably wasn't the best idea to further complicate things with the multiple list_boxes, but hey! I'm literately trudging through this, and still hoping for some more pointers.
Oh, I'm going to attach the working lsp and dcl in order for anyone to view
Dang, now I am receiving an error which I do not know how to handle.
If I was aware how the function was working in the first place i may have a better chance to debug it.
; (setq Year (atoi (set_tile "year" "0"))) (slide "sld" (strcat path (nth (setq Year (atoi (set_tile "year" "1"))) Year) ".sld"))
; (slide "sld" (strcat path (nth (atoi (set_tile "Year" "0")) Year) ".sld")) ;sld image
These are the lines that this error is coming from. " error: bad argument type: consp 1"
If they seem redundant that's likely because they are. I am attempting to combine those lines into one working statement, but am not sure what it is doing beyond running the slide function defined earlier in the lisp with "sld" as it's argument for the key, and the direct path to the location of the slide images. It appears as this also establishes some list_box controls, but somewhere in there i've fudged up.
the defun for slide is here:
(defun slide ( key file ) ;;
(if (setq file (findfile file)) ;;
(start_image key) ;;
(fill_image 0 0 (dimx_tile key) (dimy_tile key) 0) ;;
(slide_image 1 1 (- (dimx_tile key) 2) (- (dimy_tile key) 2) file) ;;
So all of this apparently means that a function requiring a list argument has been passed an incorrect data type.
I am hoping that the slide line will display any selected image from a folder full of slides, displaying only the sld that is selected in the final List_box.
that someone will take a few minutes today to help me.
Strip the nested functions down and work from the inside out to ensure each is returning what you think it should be:
- does (set_tile "Year" "0") return "0" as a string?
- does (atoi (set_tile "Year" "0")) return 0 as an integer?
... and so on.
Command: (set_tile "sld" "0")
Command: (atoi (set_tile "sld" "0"))
; error: bad argument type: stringp nil
Command: (set_tile "Year" "0") nil
Command: (atoi (set_tile "Year" "0")) ; error: bad argument type: stringp nil
I don't know how to fix this but if you would kindly explain how to manipulate these strings. This is in relation to the slide image preview and I am trying to have it keyd to a variable image, based off of the results from the final list_box.
You are trying to call (set_tile ...) on a key "sld", which is to set a value. Does that type of element have a value which can be set? If its an image tile (don't have time to do detailed parsing) then there are specific procedures to follow (Working with Programmable Dialog boxes -> Managing Dialog boxes -> Image Tiles and buttons).
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.