New macro, Vision1, check it out
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: New macro, Vision1, check it out
Version of today here on GH.
Fixes the "2 clicks to get user value" issue and hopefully the one preventing the widget display when no 3D view is available.
Also add a button (at the bottom) to make all objects visible, but it suffers a bug in the implementation of Part container (its "OutList" property doesn't correctly returns only the top level objects)...
Fixes the "2 clicks to get user value" issue and hopefully the one preventing the widget display when no 3D view is available.
Also add a button (at the bottom) to make all objects visible, but it suffers a bug in the implementation of Part container (its "OutList" property doesn't correctly returns only the top level objects)...
Re: New macro, Vision1, check it out
I commented out; self.move(Gui.getMainWindow().frameGeometry().center()..ect
This way I get the slider on the upper left all the time, I can then dock it only on mon#2, after the dock I can then move it to mon#1. Kind of a pain but at least it shows, I have been messing around with it some.
There is still a bug in your code. If you turn on user and then go into sketcher some things won't work. You can click on items and they won't operate until you go the the slider and turn off user. I wish I could be more specific, it seems kind of a moving target. I would say just try to drawing a few things and constrain, delete stuff, remove constraints and try to do stuff in the combo view.
Future stuff and some info:
In case some users don't know:
There is a panel called "selection view", it can be useful. If you mouse select a 3D object, the objects name comes up in the selection panel, right click on the name in the selection panel an pick " Goto selection", it will highlight the object in the tree ( expanding if required) no matter where it is. I would like Vision to do that someday.
I like the "vis" button. If you need to edit something, say inside an engine, you can click on objects and hide them as you work your way down thru the solids. Edit a piston for instance and hit "vis", all back to normal.
I will read up on GIt and figure out what I need to do.
Thanks
This way I get the slider on the upper left all the time, I can then dock it only on mon#2, after the dock I can then move it to mon#1. Kind of a pain but at least it shows, I have been messing around with it some.
There is still a bug in your code. If you turn on user and then go into sketcher some things won't work. You can click on items and they won't operate until you go the the slider and turn off user. I wish I could be more specific, it seems kind of a moving target. I would say just try to drawing a few things and constrain, delete stuff, remove constraints and try to do stuff in the combo view.
That was supposed to be "skinnier", typo...Hmmm... Not sure to understand the meaning of "skinner" (lack of english vocabulary inside).
Future stuff and some info:
In case some users don't know:
There is a panel called "selection view", it can be useful. If you mouse select a 3D object, the objects name comes up in the selection panel, right click on the name in the selection panel an pick " Goto selection", it will highlight the object in the tree ( expanding if required) no matter where it is. I would like Vision to do that someday.
I like the "vis" button. If you need to edit something, say inside an engine, you can click on objects and hide them as you work your way down thru the solids. Edit a piston for instance and hit "vis", all back to normal.
I will read up on GIt and figure out what I need to do.
Thanks
Last edited by freedman on Thu Jun 20, 2019 3:03 pm, edited 1 time in total.
Re: New macro, Vision1, check it out
wmayer wrote: Ping @ Dev master
Hi guys, sorry to bother. Could one tell if there is in FC observer(s)/callback(s) that can be subscribed to be called in case of following events :yorik wrote: Ping @ Python master
- A document is opened/closed (or eventually a 3D view is created/destroyed)
- The current workbench is changed (by user or app)
Re: New macro, Vision1, check it out
Basic fix of the 3 above items in today's version.
Re: New macro, Vision1, check it out
A document is opened/closed
Code: Select all
class DocObserver:
def slotCreatedDocument(self,doc):
print ("Create document")
def slotDeletedDocument(self,doc):
print ("Delete document")
obs=DocObserver()
App.addDocumentObserver(obs)
The current workbench is changed (by user or app)
Code: Select all
def wbChange(name):
print ("Activated workbench: {}".format(name))
mw=Gui.getMainWindow()
mw.workbenchActivated.connect(wbChange)
Re: New macro, Vision1, check it out
I tried this, notice the lines commented out:
This removes toggle and just changes the selected object to the user visibility. It works even though it does highlight objects faces, it might be best to structure the program this way because I'm concerned about the comments that other macros don't work correctly, that change would fix that problem. If the user picks on lines instead of faces then highlights seem to be minimal. If the clear selection is removed I believe all the sketcher issues will disappear also . This also allows the space bar to work and all selections to work as normal.
I just tried my code when clear selection and workbench selecting is removed, works just fine. It might not be as good looking this way but I think it removes future issues.
I noticed; in a multi-sketch part, when a sketch is edited, FreeCAD sets the target sketch to wireframe (to make editing easy) and the other parts are left as solids. With the sketch opened, click on "Vis" and it returns the sketch back to solid. This is very helful when trying to fit solids together.
Code: Select all
if obj.ViewObject.Transparency != 95-self.sliUser.value()*5:
obj.ViewObject.Transparency = 95-self.sliUser.value()*5
# else:
# obj.ViewObject.Transparency = 95-self.sliAll.value()*5
# Gui.Selection.clearSelection()
elif self.natState == True:
self.userToggle()
I just tried my code when clear selection and workbench selecting is removed, works just fine. It might not be as good looking this way but I think it removes future issues.
I noticed; in a multi-sketch part, when a sketch is edited, FreeCAD sets the target sketch to wireframe (to make editing easy) and the other parts are left as solids. With the sketch opened, click on "Vis" and it returns the sketch back to solid. This is very helful when trying to fit solids together.
Re: New macro, Vision1, check it out
openBrain, maybe I didn't understand your intension or something else. Here is a plan, if Vision "User" is only enabled by (Ctl + Shift) then I think everything would work with clearSelection included in the code. If we can exclude sketcher then maybe that's better but I can't see the operator holding (ctl+shift) for long while sketching.
So if the On/Off button turned into a status indicator (and only a status indicator) for (ctl + Shift) and On enables "User", that seems perfect to me and allows toggle to work. I think this would solve a bunch of logic problems. Don't bother reading my prior post if you like this concept.
Do you see some issue with these control keys and other macros?
Thanks for writing the code in; def makeVisible(self, obj):
Using this code has allowed me to change some properties that I couldn't get to prior.
I'm just rambling here, I understand that I can make a branch. I want to get thru some basic program logic so I can add my half-a-dozen buttons.
So if the On/Off button turned into a status indicator (and only a status indicator) for (ctl + Shift) and On enables "User", that seems perfect to me and allows toggle to work. I think this would solve a bunch of logic problems. Don't bother reading my prior post if you like this concept.
Do you see some issue with these control keys and other macros?
Thanks for writing the code in; def makeVisible(self, obj):
Using this code has allowed me to change some properties that I couldn't get to prior.
I'm just rambling here, I understand that I can make a branch. I want to get thru some basic program logic so I can add my half-a-dozen buttons.
Re: New macro, Vision1, check it out
Today's version patching issue with Part containers in the "make all visible" function.
Hmmm. Actually I got no real intention. Originally I found your idea interesting and useful thus just wanted to push some lines of code in case it may help.
This plan looks good. Ctrl+shift could be a (small) problem as it can create glitches where the macro "user" setting is enabled with some shortcuts (eg. Ctrl+Shift+Z for redoing). But this should never lead to weird things. Notice that this can be changed to virtually any key combination. I find Ctrl+Shift easy to press, but feel free to change.Here is a plan, if Vision "User" is only enabled by (Ctl + Shift) then I think everything would work with clearSelection included in the code. If we can exclude sketcher then maybe that's better but I can't see the operator holding (ctl+shift) for long while sketching.
So if the On/Off button turned into a status indicator (and only a status indicator) for (ctl + Shift) and On enables "User", that seems perfect to me and allows toggle to work. I think this would solve a bunch of logic problems. Don't bother reading my prior post if you like this concept.
Do you see some issue with these control keys and other macros?
You're welcome (patched code today). What about an addition that will hide all objects but selected ?Thanks for writing the code in; def makeVisible(self, obj):
Using this code has allowed me to change some properties that I couldn't get to prior.
Not sure to well understand this paragraph.I'm just rambling here, I understand that I can make a branch. I want to get thru some basic program logic so I can add my half-a-dozen buttons.
Re: New macro, Vision1, check it out
Got it, cool, and thank youHmmm. Actually I got no real intention. Originally I found your idea interesting and useful thus just wanted to push some lines of code in case it may help.
That works. This allows access to all faces of an object with everything else hidden.What about an addition that will hide all objects but selected ?
I had another thought, a little complicated: I'll call it "Vhidden". Lets say 6 buttons numbered "OBJ-1 thru OBJ-6") . These buttons link to the names of the last 6 hidden objects (in the current FreeCAD session). Any time later after a button is stored with data, it can be clicked on to set the associated object to visible. Where would this get used: I will use a car as a model example. I have my car visually just the way I want it and I want to modify a piston, I can hide the hood, now that the hood is hidden I can select the head so I hide that also. Now I can select the piston and find it's sketch in the tree with the selection panel. Once I'm finished with the edit I click on buttons 5 and 6 to unhide the head and hood. I don't need to know the names of things to hide and show items, I just click.
I have read other posts where folks want to edit buried items, I think this would make it easy.