Macro Automatic drawing

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Macro Automatic drawing

Post by jriegel »

Very good indeed!

I would like to integrate that as a command into Part or Drawing workbench..
Stop whining - start coding!
User avatar
yorik
Founder
Posts: 13664
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Macro Automatic drawing

Post by yorik »

hi there,
I'm back to activity!
Off-topic (let's begin with good old habits ;) ): I think one of the things we need to tackle for 0.14 is how to put dimensions on the drawing view. I'll redo all the draft dimension tool, but maybe it's time for something more ambitious...
jcc242
Posts: 83
Joined: Sun Apr 22, 2012 7:32 am

Re: Macro Automatic drawing

Post by jcc242 »

yorikvanhavre wrote:Off-topic (let's begin with good old habits ;) ): I think one of the things we need to tackle for 0.14 is how to put dimensions on the drawing view. I'll redo all the draft dimension tool, but maybe it's time for something more ambitious...
We should probably start a new topic on this, but I would love to try and spearhead this. I've actually already begun! I started a wiki page to just keep track of my thoughts as I comprehend the current status and methods of the Drawing module, and to add new stuff that I program:

https://sourceforge.net/apps/mediawiki/ ... umentation

I know it is horribly incomplete and poorly written, I hope to improve as I go! The problem, as always, is finding enough time to program.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Macro Automatic drawing

Post by triplus »

Hey! I know these parts from somewhere! ;)
;)
I would like to integrate that as a command into Part or Drawing workbench..
If approach from the macro would be used (centerpoint and maximum width/height) then it would probably be possible to have "recompute" support for drawing views? Right now in Drawing Workbench if you create drawing of part and if you change the size of the part then you would have to manually change scale/position for each view. I think it might be possible to simply "recompute" the drawing if centerpoint and maximum width/height would be used and this data would be stored and could be used later on? I don't know if this (recompute) would affect for example dimensions because it shouldn't delete them but dimensions should persist and new scale factor should be used. This is one important thing i think should be implemented for great drawing/dimension support in FreeCAD.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Macro Automatic drawing

Post by triplus »

I have one questions about (recent) changes introduced to FreeCAD. I am not sure i am after "solution" because after Luke work lands everything will probably work differently but still:

My macro does not work as it used to work. Something probably changed because looking at First Angle Isometric View in the past one would set Direction 1,1,1 Rotation 60. This changed to Direction 1,-1,1 Rotation 60? At least based on opening old .fcstd files from my archive in current FreeCAD master version this is how i get correct Isometric View back and quick test in my macro indicates this is the case?
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Macro Automatic drawing

Post by jmaustpc »

triplus wrote:I have one questions about (recent) changes introduced to FreeCAD. I am not sure i am after "solution" because after Luke work lands everything will probably work differently but still:

My macro does not work as it used to work. Something probably changed because looking at First Angle Isometric View in the past one would set Direction 1,1,1 Rotation 60. This changed to Direction 1,-1,1 Rotation 60? At least based on opening old .fcstd files from my archive in current FreeCAD master version this is how i get correct Isometric View back and quick test in my macro indicates this is the case?
That comes down to the fact that Y axis is different in CAD and SVG.

In the SVG standard Y0 is the top of the page, like a word processors line numbers, the Y value increases as you go down the page. So in the SVG file standard origin is top left corner. In CAD origin is bottom left. The gui in some drawing applications (for example Inkscape, which the default SVG application) has origin bottom left like CAD in the GUI even though the SVG file itself is origin top left, the application translates it.

Because originally Drawing work bench was mostly SVG oriented in many important ways, it was originally to the SVG standard, origin top left, but after some discussion a consensus was reached that it should be changed the much more common, and CAD default, origin bottom left.

This all happened just a few months ago, so earlier 0.14dev would be different from more recent 0.14dev versions.

Jim
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Macro Automatic drawing

Post by ulrich1a »

triplus wrote:My macro does not work as it used to work. Something probably changed
There is a recently change in the Draft workbench. The Draft-workbench Drawing projection gives now the same projection as the Drawing-workbench projection button. So you can have the same property settings in both projections and can combine both projections easily.
This should nothing change for functions used from the Drawing workbench.

I had also another problem in a macro. In former times "0" could be used as "False" at some function calls. I had to change the macro to use True and False instead of 1 and 0.

Ulrich
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Macro Automatic drawing

Post by triplus »

Because originally Drawing work bench was mostly SVG oriented in many important ways, it was originally to the SVG standard, origin top left, but after some discussion a consensus was reached that it should be changed the much more common, and CAD default, origin bottom left.
Thanks for detailed explanation.

On a side note to be honest in the future stuff like this should not be done unless absolutely needed. And maybe to give timestamps or version of FreeCAD the file was created with or simply "drawing format version" like v1.1 stamp and opening old drawing made in FreeCAD before the change was introduced to convert it to the new system. Basically ATM this does not make much sense because new DW workbench will land and will change things all around. But imagine that would not be the case and just because of some "administration difference" all .FCstd files created in the past do not show the views correctly anymore.
There is a recently change in the Draft workbench. The Draft-workbench Drawing projection gives now the same projection as the Drawing-workbench projection button. So you can have the same property settings in both projections and can combine both projections easily.
This should nothing change for functions used from the Drawing workbench.
Well the change (orientation standard) that affects my macro also affects all .FCstd files containing drawings that where made before the change was introduced. Views are oriented differently.

Anyway thanks for confirming what i suspected and for detailed info.
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Macro Automatic drawing

Post by ulrich1a »

triplus wrote:Basically ATM this does not make much sense because new DW workbench will land and will change things all around. But imagine that would not be the case and just because of some "administration difference" all .FCstd files created in the past do not show the views correctly anymore.
My view is, mrlukeparry needs some help from others before the new DW workbench will land.

I do understand the problem of changing the behavior of a function, but the Drawing workbench needs improvements to get a better usability. There was also a bug fix in the Drawing workbench from tanderson69. There were some projections wrong due to a wrong approach for the determination of the svg-coordinates.

Ulrich
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Macro Automatic drawing

Post by triplus »

As i understand above info basically Y - axis switched orientation? That was done intentionally and if something like that happens again in the future then i guess FreeCAD should handle this and convert old .FCstd files with drawings in them to new standard.

We probably will not be doing conversion from current SVG to new DW method and this is therefore only theoretical example but if in the future (when we will not change the whole DW in its core as it is done ATM) similar sort of decision is made with the similar effects switching Y -axis in current DW has then i guess for FreeCAD to handle this in a way old .FCstd files with drawings in them to still work correctly in newer FreeCAD.
Post Reply