[pull request] Sketcher: Virtual Space

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: [pull request] Sketcher: Virtual Space

Post by triplus »

hammax wrote: Thu Feb 01, 2018 5:06 pm ...could it be, that the VirtualSpace-Icon position does not follow the "Persistent Toolbar"-Macro.
Every time I edit the position to another place, it returns to the left upper corner and uses a single icon-line,
after restarting FreeCAD.
Win10-32 FC0.17.13190
Confirmed.
abdullah wrote: Thu Feb 01, 2018 6:56 pm I expected it to work just like the other bars (I do not recall doing anything different). However, it seems not to work. I will look into it tomorrow.
Didn't notice it myself when testing therefore i felt i had to do something about it. :lol:

https://github.com/FreeCAD/FreeCAD/pull/1288
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [pull request] Sketcher: Virtual Space

Post by abdullah »

triplus wrote: Fri Feb 02, 2018 1:07 am
Didn't notice it myself when testing therefore i felt i had to do something about it. :lol:

https://github.com/FreeCAD/FreeCAD/pull/1288
It is good that you fixed it. I have a misbehaving PR to tackle today:
https://github.com/FreeCAD/FreeCAD/pull/1283
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: [pull request] Sketcher: Virtual Space

Post by paullee »

Thanks! This is what I get before and after :)
Very useful indeed!

Screenshot from 2018-02-10 15-36-35.png
Screenshot from 2018-02-10 15-36-35.png (401.92 KiB) Viewed 1234 times
Screenshot from 2018-02-10 15-39-49.png
Screenshot from 2018-02-10 15-39-49.png (282.67 KiB) Viewed 1234 times



OS: Linux
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13247 (Git)
Build type: None
Branch: master
Hash: 5022c8df5cef0690f2c8acff4bcebd82655a5f04
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedStates (en_US)
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: [user input request] Sketcher: Virtual Space

Post by paullee »

abdullah wrote: Sat Dec 16, 2017 4:19 pm
paullee wrote: Sat Dec 16, 2017 9:18 am 1. Ability to (auto) give (unique) name each edges in a sketch which would not be repeated or reused
https://forum.freecadweb.org/viewtopic. ... ch#p198334
https://forum.freecadweb.org/viewtopic. ... ch#p198099

I totally abandon Link to External Geometry, Map to Faces etc. which, when recompute the model, totally make my test building model into chaos.
I am testing only using expression to link between sketches, arch objects - some how works, but the ability / built-in function that each edges created is given a unique name/ numbers is much more productive. So each edges is named e.g. edge001, edge002 (unlike current way), if edge001 is deleted, the name edge001 WOULD NOT BE REUSED again.

Then, an edge can be reference absolutely, with Topological Naming problem, like sketch001.edge001.vertex1.x...
I (only/mostly) link sketches using the expression engine. To partially automate it, I created Carbon Copy, which helps in some scenarios, not all.

Naming edges uniquely might help toponaming. Naming edges uniquely globally in FreeCAD might help toponaming, but it is a FC wide decision, which I only see as part of the toponaming project.

However, it is noteworthy that sketcher elements have a unique identifier (accessible at least at a c++ level). This was introduced this year to enable complex geometry manipulations of bsplines which could not rely on this "automatic naming" you refer to. It was already foreseen to use it for improving the deleting process of sketcher elements (yet to be implemented).

I have been weighing the idea of reusing this unique identifier for a "Carbon Copy 2.0", in which a sketcher element (and I do not say edge, because this only works between sketches) is "constraint" in place so as follow a sketcher element of the same type existing in another sketch. This is for the future.
My post above show hiding constraints help cleaning up the screen. The reason why there are so much reference constraints is exactly I use expression engine in another sketch linking to reference (datum) constraints in current sketch - Carbon Copy can't help in this scenario.

I am interesting in the 'unique identifier' you mentioned, hope somebody can help looking in the code and use it. My test to use the convoluting workflow: datum constraints+expression engine+reference datum constraints is not productive though works. I guess the 'unique identifier' would make resolve it fundamentally.

Thanks anyway.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [user input request] Sketcher: Virtual Space

Post by abdullah »

paullee wrote: Sat Feb 10, 2018 8:03 am
I am interesting in the 'unique identifier' you mentioned, hope somebody can help looking in the code and use it. My test to use the convoluting workflow: datum constraints+expression engine+reference datum constraints is not productive though works. I guess the 'unique identifier' would make resolve it fundamentally.

Thanks anyway.
The code is this (src/Mod/Part/App/Geometry.h), see getTag() below and the protected functions:

Code: Select all

class PartExport Geometry: public Base::Persistence
{
    TYPESYSTEM_HEADER();
public:
    virtual ~Geometry();

    virtual TopoDS_Shape toShape() const = 0;
    virtual const Handle(Geom_Geometry)& handle() const = 0;
    // Persistence implementer ---------------------
    virtual unsigned int getMemSize(void) const;
    virtual void Save(Base::Writer &/*writer*/) const;
    virtual void Restore(Base::XMLReader &/*reader*/);
    /// returns a copy of this object having a new randomly generated tag. If you also want to copy the tag, you may use clone() instead.
    /// For creation of geometry with other handles, with or without the same tag, you may use the constructors and the sethandle functions.
    /// The tag of a geometry can be copied to another geometry using the assignTag function.
    virtual Geometry *copy(void) const = 0;
    /// returns a cloned object. A cloned object has the same tag (see getTag) as the original object.
    /// if you want a copy not having the same tag, you can use copy() instead.
    /// If you want a clone with another geometry handle, it is possible to clone an object and then assign another handle or to create an object
    /// via constructor and use assignTag to assign the tag of the other geometry.
    /// If you do not desire to have the same tag, then a copy can be performed by using a constructor (which will generate another tag)
    /// and then, if necessary (e.g. if the constructor did not take a handle as a parameter), set a new handle.
    Geometry *clone(void) const;
    /// construction geometry (means no impact on a later built topo)
    /// Note: In the Sketcher and only for the specific case of a point, it has a special meaning:
    /// a construction point has fixed coordinates for the solver (it has fixed parameters)
    bool Construction;
    /// returns the tag of the geometry object
    boost::uuids::uuid getTag() const;
protected:
    /// create a new tag for the geometry object
    void createNewTag();
    /// copies the tag from the geometry passed as a parameter to this object
    void assignTag(const Part::Geometry *);

protected:
    Geometry();
    
protected:
    boost::uuids::uuid tag;    

private:
    Geometry(const Geometry&);
    Geometry& operator = (const Geometry&);
};
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: [pull request] Sketcher: Virtual Space

Post by paullee »

Thanks! Hope I can find someone to have a look!
Post Reply