DynamicData workbench [1.6 update -- ViewObject property support]

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

DynamicData workbench [1.6 update -- ViewObject property support]

Post by TheMarkster »

https://github.com/mwganson/DynamicData

Edit: 2019.07.27: New version 1.60. Now we can access view tab properties, too. These cannot be linked parametrically because ViewObject does not have setExpression() method.

Edit: 2019.07.26: New version 1.50. Now when copying/setting properties you can parametrically link the destination property to the source property if you wish. Previous versions only made a copy by value. If the parametric link option is selected when the source property changes the destination property will change with it.

Edit: 2019.06.30: New version 1.42. Fixed bug in mru list, added setting to change length of mru list.

Edit: 2019.06.29: New version 1.41 includes spreadsheet alias import. See (currently) last post in this topic for more details.

Edit: 2018.10.02: New feature in version 1.3: ability to copy / set properties from one object to another. (Only dd objects can be receivers of copies, but any object's properties' values can be set.) With this feature one can copy a property from any object to a dd object or set the value of an existing property from another property. One possible way to use this would be to make copies of an object's Placement property at various positions, and then use these copies to easily restore that placement at various positions. For example, you have might a model with a lever that can be in multiple positions, say forward, neutral, and reverse. You could copy the lever's Placement property at its various positions into a dd object, and then use those copies to set the lever's Placement as needed.


Edit: 2018.09.27: New feature in version 1.2: ability to import named constraints from selected sketches. The named constraints of the selected sketches get imported as properties into the selected dd objects. Warning: the sketch constraints get modified to reference the new properties. If the constraint uses expressions those expressions will be lost, only the numeric value gets applied to the new property. Backup your .FCStd file to be safe.

Now available in the Addon Manager -- thanks Kunda1.

With this workbench you can create custom FeaturePython objects to serve as containers for custom properties. These custom properties can then be used in much the same way as cells in a spreadsheet. Users can refer to a custom property in a sketcher constraint (or from anywhere the Expression Engine can be accessed) the same way one might refer to a cell in a spreadsheet. Take note that FCStd files containing these DynamicData dd objects can be shared with other users who do not have the DynamicData workbench installed on there systems and yet will still remain fully functional. (But without the workbench installed those other users will not be able to add/remove properties unless it is done via scripting.)

Full documentation at github https://github.com/mwganson/DynamicData

Example video:

phpBB [video]
Last edited by TheMarkster on Sat Jul 27, 2019 9:00 pm, edited 7 times in total.
UR_
Veteran
Posts: 1355
Joined: Tue Jan 03, 2017 8:42 pm

Re: DynamicData workbench

Post by UR_ »

Really cool!
thumbs-up_s.png
thumbs-up_s.png (3.41 KiB) Viewed 4650 times
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: DynamicData workbench

Post by Kunda1 »

Now available via the Addon Manager (git commit 001ea4de9)
Nice work!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: DynamicData workbench

Post by TheMarkster »

Minor update: version 1.1

** Track 5 most recently used property types and add them to the top of the property list, sort remainder of list alphabetically.
** Display version information in DynamicData string property.
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: DynamicData workbench

Post by easyw-fc »

nice feature though! :D
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: DynamicData workbench

Post by sgrogan »

TheMarkster wrote: Tue Sep 25, 2018 9:22 pm Minor update: version 1.1
Nice touch with the version info. I tested with this:

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.14802 (Git)
Build type: Release
Branch: master
Hash: dfd3d86b227099bab3649624507fcb205cdd93a2
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

Many good things here :D

I very much like the dd.dd convention, it's very fast to get to the auto-completer. I'm not sure about sharing the property type and tooltip. I used a tooltip "funky" and had no way to know it was a FloatList.

I tried giving a "name" and no value, no problem, enter it in the data tab.
I tried giving a value and no name. I get a default named "property?", but no value.
I know about seperating with ; , I am just talking about people banging away without reading the doc's (which are good BTW :) )

Unfortunately FreeCAD's auto completer doesn't recognize lists. I think this would be good for "Part Families".
If I understand correctly, FreeCAD may not recognize many of the property types in the expression engine, but they are available from Python?
"fight the good fight"
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: DynamicData workbench

Post by TheMarkster »

Thanks for testing and for the feedback. New version: 1.11
sgrogan wrote: Tue Sep 25, 2018 10:32 pm
I very much like the dd.dd convention, it's very fast to get to the auto-completer. I'm not sure about sharing the property type and tooltip. I used a tooltip "funky" and had no way to know it was a FloatList.
There was a bug, hopefully fixed now. If no tooltip is given, it (should hopefully) now default to the property type.

Example:

myProperty;myGroup;;32

Should produce a float (assuming Float was the type chosen) called ddMyProperty in group myGroup with tooltip = "Float" set to initial value of 32

Property type will now be part of each tooltip, e.g. [Float] my tooltip instead of just my tooltip.
I tried giving a "name" and no value, no problem, enter it in the data tab.
There was a bug (now also hopefully fixed) where there was a warning about not being able to set the attribute when ending with the semicolon but no value.

Example:

myName;myGroup;myTip;

was generating a warning about not being able to evaluate the empty string after the last ;

Being able to add a value while entering the property name is really just a convenience. If it fails, no big deal since you can always enter it in the data tab. But I would like to have it work most of the time with simple types, like float.
I tried giving a value and no name. I get a default named "property?", but no value.
Yet another bug. I think it's fixed now. Entering:

;;;32

after choosing float type should produce a property named ddProp in default group with tooltip Float and 32 as the initial value.

Subsequent no name values would be ddProp1, ddProp2, ddProp3, etc.
I know about seperating with ; , I am just talking about people banging away without reading the doc's (which are goo BTW :) )
I initially used commas, but then got to thinking some folks use commas as separators for decimal values and I wanted them to be able to enter FloatList initial values. For example, if 3,14 is entered there wouldn't be a way to figure out if that meant 3 and 14 as 2 separate floats or 3.14. To enter an initial set of FloatList values:

myFloatPropertyName;myGroup;myTooltip;3,14;2;7,31;14

Should work (hopefully) and produce 3.14, 2, 7.31, 14 as initial values.
Unfortunately FreeCAD's auto completer doesn't recognize lists. I think this would be good for "Part Families".
If I understand correctly, FreeCAD may not recognize many of the property types in the expression engine, but they are available from Python?
You can access the values from a FloatList from the expression engine. For example, you can create a Float list with 0,1,2,3 as initial values, then reference them from a sketch constraint as such:

=dd.ddMyFloatListName[1]

This would set that constraint to the index 1 value (1 in this list, since lists are 0-indexed). So, if you wanted to keep the property count low you could use a list and access the list items that way. But there is a bug in the spreadsheet module that keeps it from updating automatically when the list gets modified.

There are some property types that might be available from python, but that didn't produce visible properties, so I didn't include them. That was basically the test for inclusion -- if it creates a visible property it got added, if not then it didn't get added. For example, MaterialList works, but Material didn't while Color worked, but ColorList didn't. But I need to go back through and retest all of these again to make sure I'm not leaving anything out. I don't know if many of these property types will ever be useful for anything, but creative people can find uses for things if you give them a chance.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: DynamicData workbench

Post by sgrogan »

I tested v1.12 and the same core FreeCAD as above.
TheMarkster wrote: Wed Sep 26, 2018 1:16 am Property type will now be part of each tooltip, e.g. [Float] my tooltip instead of just my tooltip.
Thank-you for this :)
Everything else seems good.

When updating, the add-ons manager dialog progress monitor didn't finish, but I closed it, FreeCAD, and re-started FreeCAD and everything was good. Don't know if this is related to your workbench, I will investigate.

This will be very handy, thanks for the contribution :D
"fight the good fight"
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: DynamicData workbench [new feature copy/set properties]

Post by TheMarkster »

New version 1.32.

Can now set a property value of any object from any property of any other object, need not be a dd object involved.

Normally, with most properties it is trivial to set the value of one property to match that of another property. For example, given 2 objects: Cube and Cube001 we can already very easily set Cube001's Height property to the same value as Cube's Height property just by entering it manually from within the data tab of the property view. But if it's a placement property it can be much more tedious to do this by hand. Other types that also could be more tedious: Matrix, Vector, List types, and Link types.

A particular use case I have in mind for this is when we would like to align 2 cylinder objects end to end, but the cylinder that we already have positioned is at some odd position and on some odd angle of rotation.

phpBB [video]
Attachments
2cylinders.FCStd
(3.98 KiB) Downloaded 69 times
User avatar
Vincent B
Veteran
Posts: 4741
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: DynamicData workbench [new feature copy/set properties]

Post by Vincent B »

Why force isn't in Newton? how to convert in KgF?
How to match volume (mm3) and volume (Liter). Float can't do. :roll:
Have a look inside my file about a tank.
Attachments
Tank.FCStd
(3.69 KiB) Downloaded 69 times
Post Reply