DWire edition when is base of a structure

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

DWire edition when is base of a structure

Post by bitacovir »

Hi. I have a problem when I want to edit a DWire which is base of a structure.
I draw a DWire to create a Slab with the Structure command.
But if I want to edit the Dwire, this loses its surface and the slab is not updated any more. In adition, the Dwire can not be used to create a new slab.
I am sharing the file.
2016-02-06 10_23_24-.png
2016-02-06 10_23_24-.png (133.53 KiB) Viewed 1443 times
2016-02-06 10_35_18-FreeCAD.png
2016-02-06 10_35_18-FreeCAD.png (42.54 KiB) Viewed 1443 times
2016-02-06 10_43_20-FreeCAD.png
2016-02-06 10_43_20-FreeCAD.png (48.88 KiB) Viewed 1443 times
pruebaDWire.FCStd
(9.25 KiB) Downloaded 61 times

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6385 (Git)
Build type: Release
Branch: master
Hash: 2e2192f88aec126caacf4f39e19b8bfad471bbb1
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: DWire edition when is base of a structure

Post by yorik »

I'm very glad you are not abandoning freecad bitacovir! ;)

There is a problem in that wire, that after editing it, even if I take care of setting the working plane correctly, it is not plane anymore, and therefore it doesn't create a face, and the structure object doesn't update anymore. I'm not really sure why that happens, probably a problem of precision... I couldn't reproduce that with fresh wires yet...

In the meantime, I created this macro that can fix the problem. If after editing a wire it is not flat anymore (it refuses to form a face), selecting three vertices from that wire, then running the macro, will fix it:

Code: Select all

import FreeCAD,FreeCADGui,Draft

# check selection
sel = FreeCADGui.Selection.getSelectionEx()
ok = True
if len(sel) != 1:
    FreeCAD.Console.PrintError("Please select 3 vertices from one Draft wire\n")
    ok = False
sel = sel[0]
if Draft.getType(sel.Object) not in ["Wire","BSpline"]:
    FreeCAD.Console.PrintError("Please select 3 vertices from one Draft wire\n")
    ok = False
if len(sel.SubElementNames) != 3:
    FreeCAD.Console.PrintError("Please select 3 vertices from one Draft wire\n")
    ok = False
for e in sel.SubElementNames:
    if not "Vertex" in e:
        FreeCAD.Console.PrintError("Please select 3 vertices from one Draft wire\n")
        ok = False

if ok:
    # define a plane
    p1 = getattr(sel.Object.Shape,sel.SubElementNames[0]).Point
    p2 = getattr(sel.Object.Shape,sel.SubElementNames[1]).Point
    p3 = getattr(sel.Object.Shape,sel.SubElementNames[2]).Point
    p4 = p2.sub(p1).cross(p3.sub(p1))
    
    # project wire points
    points = []
    for p in sel.Object.Points:
        points.append(p.projectToPlane(p1,p4))
    sel.Object.Points = points
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: DWire edition when is base of a structure

Post by bitacovir »

yorik wrote:I'm very glad you are not abandoning freecad bitacovir! ;)

There is a problem in that wire, that after editing it, even if I take care of setting the working plane correctly, it is not plane anymore, and therefore it doesn't create a face, and the structure object doesn't update anymore. I'm not really sure why that happens, probably a problem of precision... I couldn't reproduce that with fresh wires yet...

In the meantime, I created this macro that can fix the problem. If after editing a wire it is not flat anymore (it refuses to form a face), selecting three vertices from that wire, then running the macro, will fix it:

Thank you very much Yorik for this help. You are right. This Dwire has something wrong. I draw it using a previous geometry as reference. Drawing other Dwires normally the edition works fine. Anyway, thanks for the macro.

About FreeCAD, I fall in love with the program. I have been intensively working with it for more than a week. And when I say intensively I am saying more than 6 hrs every day. The performance of the program has been wonderful. No crash at all. Two weeks ago I decided to use it for a professional project that I am working on. Took me one week to get familiar with the commands and the "method". Your tutorial and other guides were a great help. In the last week I developed completely my project in FreeCAD, once I understood how to work with some tricky functions like snap and working plane.
Now, I am extracting 2D drawings to elaborate the blueprints, using Arch Section Plane tool.
I can not show you images of the whole project because it will be used in a patent for the costumer. But I put here a small screenshot of one detail of the project. All the elements has been create in FreeCAD. Only elements such as nuts have been imported using Macro BOLT.
I just want to use the opportunity to congratulate you and the rest of the developer team for the good work done with this wonderful program. It achieved a very good quality level and I think I will be more and more popular between architects.
2016-02-07 12_25_17-FreeCAD.png
2016-02-07 12_25_17-FreeCAD.png (30.69 KiB) Viewed 1392 times
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: DWire edition when is base of a structure

Post by yorik »

Great to hear that! The population of "freecarchitects" is growing!
Post Reply