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

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
I have this code working.  The problem now is that it isn't grabbing all the information for blocks.  It is leaving out the scale values, and I'm not sure why.  The way the code works, because it's the only way I found out how to do it, is once you pick and object, it prints to the command line the properties via (vlax-dump-object.... ).  But before that, it tells acad that it wants to keep up the log file, this is how I grab all the properties.  If anyone knows a better way, I'm all ears.  I will post the file because the code looks pretty nasty.

Any help is appreciated. Thanks in advance.  And Happy Holidays to All.
Tim

ps.  I couldn't get the while to loop right, that is why it is commented out in the code.
Tim

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

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #1 on: December 23, 2005, 07:51:06 PM »
You mean something like this?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #2 on: December 24, 2005, 04:54:43 AM »
Yea.  That looks like what I was trying to do (but a whole lot nicer).  Can you tell me how you got there?  If not I understand.  Maybe a hint then.  The way I'm doing it is not the best, and your looks a lot better.  I don't know if I can dl and use a fas at work.  Then don't want me doing stuff like that.

Thanks.
Tim
Tim

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

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #3 on: December 24, 2005, 07:58:06 AM »
Hint: I walk the atoms family, pulling out properties / methods as available / applicable for the object selected.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

nivuahc

  • Guest
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #4 on: December 24, 2005, 08:04:56 AM »
<Lurch> You raaaang? </Lurch>

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #5 on: December 24, 2005, 08:23:34 AM »
<Lurch> You raaaang? </Lurch>

<canajun> eh? </canajun>
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

nivuahc

  • Guest
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #6 on: December 24, 2005, 08:29:45 AM »
Hint: I walk the atoms family...

Maybe I'm showing my age

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #7 on: December 24, 2005, 08:36:57 AM »
Dang, that's funny Chuck, I'm embarrassed I needed 'splainin'. I remember the original too.  :oops:

There was a point as kids when we were referred to as "Cousin Its" because of the long hair thang (gone now).
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

nivuahc

  • Guest
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #8 on: December 24, 2005, 08:41:00 AM »
That's funny, my Mom always called me Fester

I think it had something to do with my bathing habits (or lack thereof).

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #9 on: December 24, 2005, 08:44:31 AM »
Let me guess, your feet smelled like cheese.

 :-o
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

nivuahc

  • Guest
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #10 on: December 24, 2005, 08:47:10 AM »
Limburger  :oops:

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #11 on: December 24, 2005, 04:42:01 PM »
Hint: I walk the atoms family, pulling out properties / methods as available / applicable for the object selected.
Thanks Michael.  I will work on this one Tuesday when I get back to work and Acad.  I have not worked at all with atoms, so this will be a good learning experience.

Hope everyone gets what they want from the Holidays.
Tim
Tim

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

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #12 on: December 24, 2005, 07:59:33 PM »
Hi Tim, these snips may prove useful --

GetVlaAtoms

Code: [Select]
(defun GetVlaAtoms ( )
    (vl-remove-if-not
       '(lambda (symbol)   
            (wcmatch
                (vl-symbol-name symbol)
                "vla-*"
            )
        )
        (atoms-family 0)
    )
)

GetVlaProperties

Code: [Select]
(defun GetVlaProperties ( atoms )
    (vl-sort
        (mapcar
           '(lambda (symbolname) (substr symbolname 9))
            (vl-remove-if-not
               '(lambda (symbolname)   
                    (wcmatch
                        symbolname
                        "vla-get-*" ;; don't need 'put'
                    )
                )
                (mapcar 'vl-symbol-name atoms)
            )
        )
        '<
    )   
)

GetVlaMethods

Code: [Select]
(defun GetVlaMethods ( atoms )
    (vl-sort
        (mapcar
           '(lambda (symbolname) (substr symbolname 5))
            (vl-remove-if
               '(lambda (symbolname)   
                    (wcmatch
                        symbolname
                        "vla-get-*,vla-put-*" ;; need 'put'
                    )
                )
                (mapcar 'vl-symbol-name atoms)
            )
        )   
       '<
    )   
)

Use GetVlaAtoms to get the initial susbset of vla-* atoms, then pass said subset to GetVlaProperties and GetVlaMethods to get the properties and methods respectively (as opposed to multiple atoms-family calls which would be somewhat less efficient).

Another note: You may think GetVlaProperties and GetVlaMethods are the same, but they're not -- note the use of vl-remove-if-not and vl-remove-if respectively and the filtering arguments employed. I know they both could have been written generically as one function that takes more arguments but I didn't see the need as they'd only be used these two ways.

Sorry for the bla bla bla part, can't help myself.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

GDF

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

Take a look at this one by Michael Puckett.

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

GDF

  • Water Moccasin
  • Posts: 2081
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #14 on: December 26, 2005, 10:04:05 AM »
Tim

Really like your test version. I didn't realize that you could modify the properties with it, upon my first test.
Can't wait for your next version.

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

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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #30 on: December 28, 2005, 10:38:18 PM »
Tim,
I like this version better.
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.

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 #31 on: December 28, 2005, 10:41:01 PM »
Tim, Do you use DosLib ?

Have a look at the dos_proplist
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.

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 #32 on: December 28, 2005, 10:42:53 PM »
.. You may have to use something like ObjectDCL to get the fully interactive result you want though, I think.
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 #33 on: December 29, 2005, 02:35:12 AM »
Tim, Do you use DosLib ?

Have a look at the dos_proplist
I try not to use outside programs.  I have it installed at work, but I havn't used it.  The company I work for has code writes, or hired coders that use it.  I have no idea what all DosLib can do.

Tim,
I like this version better.

Thanks CAB.  I think it functions a lot better also.  I hope Michael doesn't mind me posting the code.  It kind of looks like his routine now.
Tim

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

Please think about donating if this post helped you.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #34 on: December 29, 2005, 09:51:46 AM »
Way to go Tim. I like this newer version better to.

Also have you looked at:
;;;    LSPDATA.lsp- Express Tool data for lsp command
;;;    Copyright © 1999 by Autodesk, Inc.


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

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #35 on: December 29, 2005, 11:17:12 AM »
Way to go Tim. I like this newer version better to.

Also have you looked at:
;;;    LSPDATA.lsp- Express Tool data for lsp command
;;;    Copyright © 1999 by Autodesk, Inc.


Gary

Thanks Gary, and I never knew about that one either.  I guess I know enough to be dangerous, but not enough still.

I saw a post that MP did that shows how to get to the help files, and I was going to add that to my code also, but then it would work a LOT like his code, so i would rather get his blessing before I do that.  I have it working here.  I think it can be a big help if people don't know what information (type) to enter for new values.

Thanks again all who have helped, and tested it. :-)
Tim

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

Please think about donating if this post helped you.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #36 on: December 30, 2005, 02:41:36 PM »
Tim

Just could not keep my hands off it...hope you don't mind. Made minor dcl changes.
Thanks for sharing your routine.

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

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Just for fun. Make a dialog box of all editable properties per object.
« Reply #37 on: December 30, 2005, 03:01:52 PM »
Tim

Just could not keep my hands off it...hope you don't mind. Made minor dcl changes.
Thanks for sharing your routine.

Gary
:lmao:
Some how I knew that if you were going to use it, you would change it somehow.  It's all good as long as you find it useful.  Have fun with it, and may you have a Happy New Years.
Tim

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

Please think about donating if this post helped you.