Author Topic: Just for fun. Make a dialog box of all editable properties per object.  (Read 23728 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #15 on: December 27, 2005, 08:31:07 AM »
Tim

Just a quick note, the routine does not work on plines:

* Select object [Nested level] *; IAcadLWPolyline: AutoCAD Lightweight Polyline
Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00c2eb8c>
;   Area (RO) = 0.0
;   Closed = 0
;   ConstantWidth = 0.0
;   Coordinate = ...Indexed contents not shown...
;   Coordinates = (-1.56607 10.6713 18.1333 10.6713)
;   Document (RO) = #<VLA-OBJECT IAcadDocument 0d7df554>
;   Elevation = 0.0
;   Handle (RO) = "7D"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0febcea4>
;   Layer = "0"
;   Length (RO) = 19.6994
;   Linetype = "ByLayer"
;   LinetypeGeneration = 0
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 2130165352
;   ObjectName (RO) = "AcDbPolyline"
;   OwnerID (RO) = 2130164984
;   Pl
 Error --> Invalid number of parameters
Command:

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

whdjr

  • Guest
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #16 on: December 27, 2005, 10:27:40 AM »
Tim,

Here's one I wrote for attributes that gives you a variable dialog box with all the attributes listed for the selected block.  Then it allows you to match any selected attributes from the reference block to selected blocks.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #17 on: December 27, 2005, 11:10:13 AM »
Thanks Michael.  Those will be a big help.  I want to understand what they are doing, so I will study the help guide, and other information I can find.  With what you posted, would you suggest getting a list of all the properties and methods per drawing, and then just filtering per object selected?  I am learning that way, thinking of speed.

Thanks Gary.  I was having problems on blocks.  It would hang up when there was complex objects it seems.  I think with the help from MP (code provided, and knowledge) this will be a useful tool, and fun to code, and a great learning experience.

Thanks Will for the link.  I will test it when I get a chance.  It looks helpful.

Off to learn some things in the help and so forth.
Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #18 on: December 27, 2005, 03:07:40 PM »
I'm having a little problem.  When I exit the dialog box, I run this routine to check to see if anything has changed.
Code: [Select]
(defun EditObjectsProperties (/ NewValue OldValue)

(mapcar
 '(lambda (x)
  (if
   (and
    (/= (get_tile x) "*Error getting value!!")
    (not
     (equal
      (setq NewValue
       (cond
        ((= (strcase x) "LAYER")
         (nth (atoi (get_tile x)) LayList)
        )
        ((= (strcase x) "LINETYPE")
         (nth (atoi (get_tile x)) LTList)
        )
        ((= (strcase x) "STYLENAME")
         (nth (atoi (get_tile x)) StyList)
        )
        ((= (strcase x) "TEXTSTYLE")
         (nth (atoi (get_tile x)) StyList)
        )
        (t
         (get_tile x)
        )
       )
      )
      (setq OldValue (vlax-get tmpObj x))
      0.001
     )
    )
    (vlax-property-available-p tmpObj x T)
   )
   (if
    (vl-catch-all-error-p
     (vl-catch-all-apply 'vlax-put (list tmpObj x NewValue))
    )
    (prompt (strcat "\n Could not update property \"" x "\"!!" (vl-princ-to-string OldValue) "  " (vl-princ-to-string NewValue)))
    (prompt (strcat "\n---- Updated property \"" x "\""))
   )
  )
 )
 PropList
)
)
PropList = List of available properties
tmpObj = Is the object selected to be changed.
All the prompts are for error testing.

My test does not seem to work the way I think it should.  He is a copy from the command line.
Quote
Command:
EDITPROPERTIES
 Select object to edit properties:
---- Updated property "Color"
 Could not update property "EndPoint"!!(9.73584 2.95454 0.0)  (9.73584 2.95454 0.0)
---- Updated property "LinetypeScale"
---- Updated property "LineWeight"
 Could not update property "Normal"!!(0.0 0.0 1.0)  (0.0 0.0 1.0)
 Could not update property "StartPoint"!!(3.43571 5.64089 0.0)  (3.43571 5.64089 0.0)
---- Updated property "Thickness"
 Could not update property "TrueColor"!!#<VLA-OBJECT IAcadAcCmColor 193188e0>  #<VLA-OBJECT IAcadAcCmColor 19320220>
---- Updated property "Visible"

I didn't even change anything, but my test thinks I did.  How can I code this better to have it only change (or try) items that have been changed in the dialog box?

Another question:
I'm not sure if this is possible.  When the item to change is a point I'm trying to have the user be able to either select a point, or type it in.  I have the code to add a pick button next to the edit box when the current point value is displayed.  I know I need an action tile for the button, but is there any way to write one on the fly?  I was thinking of maybe writing a lisp to a temp file, load it, then delete it, but I'm not sure if that will work.  Or is there a way to just write the action tile to the command line?

Thanks for any tips, answers, anything really.  The code kind of works, so if you need the code I can post the whole thing.
Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #19 on: December 27, 2005, 03:58:11 PM »
I figured out my check.  I was comparing strings to reals, integers and lists.  I had to convert them back to what they should be.  I still don't have an answer to this.
Another question:
I'm not sure if this is possible.  When the item to change is a point I'm trying to have the user be able to either select a point, or type it in.  I have the code to add a pick button next to the edit box when the current point value is displayed.  I know I need an action tile for the button, but is there any way to write one on the fly?  I was thinking of maybe writing a lisp to a temp file, load it, then delete it, but I'm not sure if that will work.  Or is there a way to just write the action tile to the command line?

Thanks.
Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #20 on: December 27, 2005, 04:15:31 PM »
It works for me now, but not with all the bells and whistles that I want.  I will continue to work on this.  Feel free to leave any feed back here.

Tim

Edit: Added an Undo mark to the routine, and posted the new file.
Edit: Attached file with corrections mentioned below.  Thanks.
« Last Edit: December 27, 2005, 05:12:51 PM by T.Willey »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

deegeecees

  • Guest
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #21 on: December 27, 2005, 04:34:55 PM »
Here's what it gave me Tim:

Quote
Command: (load"grabproperties")

 -- type "EditProperties" to use."\n -- type \"EditProperties\" to use."

Command: editproperties

 Error --> no function definition: VL-STARTUNDOMARK
Command:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #22 on: December 27, 2005, 04:40:00 PM »
That would probably be meant to be
(vla-StartUndoMark
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.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #23 on: December 27, 2005, 05:06:12 PM »
That would probably be meant to be
(vla-StartUndoMark
Yup.  Sorry about that.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

deegeecees

  • Guest
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #24 on: December 27, 2005, 05:07:46 PM »
Updating...

deegeecees

  • Guest
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #25 on: December 27, 2005, 05:23:13 PM »
... and now:

It just dumps what looks like a DCL file to be written "on-the-fly" to the text screen and gives me the old streamp carp:

Quote
Error --> bad argument type: streamp nil

Granted I'm using 2002 for testing, will try in 2004, please hold...


... nope, same thing in 2004. FYI.

Happy coding.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #26 on: December 27, 2005, 05:36:02 PM »
Thanks Kerry for answering these.  I can check more often, so that you don't have to do so much work. :-)

Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #27 on: December 27, 2005, 05:38:08 PM »
That's OK Tim, I just happened to be riding past.  :wink:

.. and, I removed my post regarding folders, cause that was a guess ..
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.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #28 on: December 27, 2005, 05:38:51 PM »
You can try changing the direction of the file.  Right now it's coded to go to the temp folder, but if you can't write to that location, then you can change it.  Change this line to a directory you have read/write access to.
Code: [Select]
(setq DiaFile "c:/temp/tmpPropertyDialog.dcl")

Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #29 on: December 28, 2005, 04:10:55 PM »
I have been beaten :-(.  I can not figure out how to do it the way I want, so I went another way.  I use a list box instead of all the edit boxes.  I am attaching the lisp and the dcl file.  Let me know if anyone finds it useful.  Thanks to all for all the help I have received here.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.