Re: [Kicad-developers] Fwd: Re: [PATCH] Fix for 3D model offset

2017-12-01 Thread José Ignacio
That's one of the risks that come from using the dev version without
looking at the changes beforehand. The impact should be pretty small.

On Fri, Dec 1, 2017 at 11:50 AM, easyw  wrote:

> just a side note on this thread:
> this latest patch is messing up all the previous offset values in boards
> that a user, which had the latest and previous patched pcbnew, opened and
> saved ...
> And obviously this mess is happening in a 'silent' way, without any
> warning message for the user which will find all the offset multiplied by
> 25.4...
> IMO this is just a bigger headache than what I even thought it may have
> been
>
>
>
> On 12/01/2017 4:17 PM, Wayne Stambaugh wrote:
>
>> On 12/01/2017 06:31 AM, jp charras wrote:
>>
>>> Le 30/11/2017 à 13:43, Oliver Walters a écrit :
>>>
 Rebuilt and attached

 On Thu, Nov 30, 2017 at 7:53 PM, jp charras >
 wrote:


   Message transféré 
  Sujet : Re: [Kicad-developers] [PATCH] Fix for 3D model offset
  Date : Thu, 30 Nov 2017 09:43:05 +0100
  De : jp charras >> jp.char...@wanadoo.fr>>
  Répondre à : KiCad Developers >
  Pour : Oliver Walters >> oliver.henry.walt...@gmail.com>>

  Le 30/11/2017 à 08:38, Oliver Walters a écrit :
  > JP, Wayne,
  >
  > Any update on how we want to handle this?

>>>
>>> Looks good to me now.
>>>
>>> Wayne, do you want me to commit these patchs?
>>>
>>>
>> Please commit this patch when you get a chance.  The reason it took me
>> so long to pull the trigger on this is that I was trying to think of a
>> better way to handle it.  I can not really think of a better solution so
>> we will have to live with it unless someone else has a better idea.
>> It's best to make the change so everyone will get their complaining over
>> with now rather than later.  I think for version 6, I would like to
>> revisit the footprint file format given some of its limitations but I'm
>> going to hold off on that until after the new schematic file formats are
>> done.
>>
>> Thanks,
>>
>> Wayne
>>
>> ___
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Fwd: Re: [PATCH] Fix for 3D model offset

2017-12-01 Thread easyw

just a side note on this thread:
this latest patch is messing up all the previous offset values in boards 
that a user, which had the latest and previous patched pcbnew, opened 
and saved ...
And obviously this mess is happening in a 'silent' way, without any 
warning message for the user which will find all the offset multiplied 
by 25.4...

IMO this is just a bigger headache than what I even thought it may have been


On 12/01/2017 4:17 PM, Wayne Stambaugh wrote:

On 12/01/2017 06:31 AM, jp charras wrote:

Le 30/11/2017 à 13:43, Oliver Walters a écrit :

Rebuilt and attached

On Thu, Nov 30, 2017 at 7:53 PM, jp charras >
wrote:


  Message transféré 
 Sujet : Re: [Kicad-developers] [PATCH] Fix for 3D model offset
 Date : Thu, 30 Nov 2017 09:43:05 +0100
 De : jp charras >
 Répondre à : KiCad Developers >
 Pour : Oliver Walters >

 Le 30/11/2017 à 08:38, Oliver Walters a écrit :
 > JP, Wayne,
 >
 > Any update on how we want to handle this?


Looks good to me now.

Wayne, do you want me to commit these patchs?



Please commit this patch when you get a chance.  The reason it took me
so long to pull the trigger on this is that I was trying to think of a
better way to handle it.  I can not really think of a better solution so
we will have to live with it unless someone else has a better idea.
It's best to make the change so everyone will get their complaining over
with now rather than later.  I think for version 6, I would like to
revisit the footprint file format given some of its limitations but I'm
going to hold off on that until after the new schematic file formats are
done.

Thanks,

Wayne

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp



___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Fwd: Re: [PATCH] Fix for 3D model offset

2017-12-01 Thread jp charras
Le 01/12/2017 à 16:17, Wayne Stambaugh a écrit :
> On 12/01/2017 06:31 AM, jp charras wrote:
>> Le 30/11/2017 à 13:43, Oliver Walters a écrit :
>>> Rebuilt and attached
>>>
>>> On Thu, Nov 30, 2017 at 7:53 PM, jp charras >> >
>>> wrote:
>>>
>>>
>>>  Message transféré 
>>> Sujet : Re: [Kicad-developers] [PATCH] Fix for 3D model offset
>>> Date : Thu, 30 Nov 2017 09:43:05 +0100
>>> De : jp charras >
>>> Répondre à : KiCad Developers >> >
>>> Pour : Oliver Walters >> >
>>>
>>> Le 30/11/2017 à 08:38, Oliver Walters a écrit :
>>> > JP, Wayne,
>>> >
>>> > Any update on how we want to handle this?
>>
>> Looks good to me now.
>>
>> Wayne, do you want me to commit these patchs?
>>
> 
> Please commit this patch when you get a chance.  The reason it took me
> so long to pull the trigger on this is that I was trying to think of a
> better way to handle it.  I can not really think of a better solution so
> we will have to live with it unless someone else has a better idea.
> It's best to make the change so everyone will get their complaining over
> with now rather than later.  I think for version 6, I would like to
> revisit the footprint file format given some of its limitations but I'm
> going to hold off on that until after the new schematic file formats are
> done.
> 
> Thanks,
> 
> Wayne
> 

I committed these fixes.

Thanks, Oliver.


-- 
Jean-Pierre CHARRAS

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Fwd: Re: [PATCH] Fix for 3D model offset

2017-12-01 Thread Wayne Stambaugh
On 12/01/2017 06:31 AM, jp charras wrote:
> Le 30/11/2017 à 13:43, Oliver Walters a écrit :
>> Rebuilt and attached
>>
>> On Thu, Nov 30, 2017 at 7:53 PM, jp charras > >
>> wrote:
>>
>>
>>  Message transféré 
>> Sujet : Re: [Kicad-developers] [PATCH] Fix for 3D model offset
>> Date : Thu, 30 Nov 2017 09:43:05 +0100
>> De : jp charras >
>> Répondre à : KiCad Developers > >
>> Pour : Oliver Walters > >
>>
>> Le 30/11/2017 à 08:38, Oliver Walters a écrit :
>> > JP, Wayne,
>> >
>> > Any update on how we want to handle this?
> 
> Looks good to me now.
> 
> Wayne, do you want me to commit these patchs?
> 

Please commit this patch when you get a chance.  The reason it took me
so long to pull the trigger on this is that I was trying to think of a
better way to handle it.  I can not really think of a better solution so
we will have to live with it unless someone else has a better idea.
It's best to make the change so everyone will get their complaining over
with now rather than later.  I think for version 6, I would like to
revisit the footprint file format given some of its limitations but I'm
going to hold off on that until after the new schematic file formats are
done.

Thanks,

Wayne

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Fwd: Re: [PATCH] Fix for 3D model offset

2017-12-01 Thread jp charras
Le 30/11/2017 à 13:43, Oliver Walters a écrit :
> Rebuilt and attached
> 
> On Thu, Nov 30, 2017 at 7:53 PM, jp charras  >
> wrote:
> 
> 
>  Message transféré 
> Sujet : Re: [Kicad-developers] [PATCH] Fix for 3D model offset
> Date : Thu, 30 Nov 2017 09:43:05 +0100
> De : jp charras >
> Répondre à : KiCad Developers  >
> Pour : Oliver Walters  >
> 
> Le 30/11/2017 à 08:38, Oliver Walters a écrit :
> > JP, Wayne,
> >
> > Any update on how we want to handle this?

Looks good to me now.

Wayne, do you want me to commit these patchs?


-- 
Jean-Pierre CHARRAS

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Fwd: Re: [PATCH] Fix for 3D model offset

2017-11-30 Thread Oliver Walters
Rebuilt and attached

On Thu, Nov 30, 2017 at 7:53 PM, jp charras  wrote:

>
>  Message transféré 
> Sujet : Re: [Kicad-developers] [PATCH] Fix for 3D model offset
> Date : Thu, 30 Nov 2017 09:43:05 +0100
> De : jp charras 
> Répondre à : KiCad Developers 
> Pour : Oliver Walters 
>
> Le 30/11/2017 à 08:38, Oliver Walters a écrit :
> > JP, Wayne,
> >
> > Any update on how we want to handle this?
> >
> > On Mon, Nov 27, 2017 at 9:48 PM, Oliver Walters <
> oliver.henry.walt...@gmail.com
> > > wrote:
> >
>
> Hi Oliver,
> Could you rebase and rebuild yours patches: they do not apply on current
> master.
>
> Thanks.
>
>
> --
> Jean-Pierre CHARRAS
>
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
From a16bf42914e78ca69c51d309b62784d9730a0973 Mon Sep 17 00:00:00 2001
From: Oliver 
Date: Mon, 27 Nov 2017 21:46:53 +1100
Subject: [PATCH 3/3] Write "offset" only if non-zero

- Use "at" if all offset dimensions are zero
- Use "offset" otherwise
---
 pcbnew/kicad_plugin.cpp | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp
index 1314864..518e1c6 100644
--- a/pcbnew/kicad_plugin.cpp
+++ b/pcbnew/kicad_plugin.cpp
@@ -1143,9 +1143,22 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
 /* Write 3D model offset in mm
  * 4.0.x wrote "at" which was actually in inches
  * 5.0.x onwards, 3D model offset is written using "offset"
+ *
+ * If the offset is all zero, write "at" (fewer file changes)
+ * Otherwise, write "offset"
  */
 
-m_out->Print( aNestLevel+2, "(offset (xyz %s %s %s))\n",
+wxString offsetTag = "offset";
+
+if( bs3D->m_Offset.x == 0 &&
+bs3D->m_Offset.y == 0 &&
+bs3D->m_Offset.z == 0 )
+{
+offsetTag = "at";
+}
+
+m_out->Print( aNestLevel+2, "(%s (xyz %s %s %s))\n",
+  offsetTag.ToStdString().c_str(),
   Double2Str( bs3D->m_Offset.x ).c_str(),
   Double2Str( bs3D->m_Offset.y ).c_str(),
   Double2Str( bs3D->m_Offset.z ).c_str() );
-- 
2.7.4

From be3002200847e49f7670099a0acacc9c98673e7f Mon Sep 17 00:00:00 2001
From: Oliver 
Date: Mon, 27 Nov 2017 08:20:02 +1100
Subject: [PATCH 2/3] Decode "offset" in STEP export tool

- Read "at" as inches
- Read "offset" as mm
---
 pcbnew/kicad_plugin.cpp |  2 ++
 utils/kicad2step/pcb/kicadmodel.cpp | 25 +
 2 files changed, 27 insertions(+)

diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp
index f42dcff..1314864 100644
--- a/pcbnew/kicad_plugin.cpp
+++ b/pcbnew/kicad_plugin.cpp
@@ -1142,7 +1142,9 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
 
 /* Write 3D model offset in mm
  * 4.0.x wrote "at" which was actually in inches
+ * 5.0.x onwards, 3D model offset is written using "offset"
  */
+
 m_out->Print( aNestLevel+2, "(offset (xyz %s %s %s))\n",
   Double2Str( bs3D->m_Offset.x ).c_str(),
   Double2Str( bs3D->m_Offset.y ).c_str(),
diff --git a/utils/kicad2step/pcb/kicadmodel.cpp b/utils/kicad2step/pcb/kicadmodel.cpp
index 6f680e0..61395ba 100644
--- a/utils/kicad2step/pcb/kicadmodel.cpp
+++ b/utils/kicad2step/pcb/kicadmodel.cpp
@@ -80,12 +80,37 @@ bool KICADMODEL::Read( SEXPR::SEXPR* aEntry )
 std::string name = child->GetChild( 0 )->GetSymbol();
 bool ret = true;
 
+/*
+ * Version 4.x and prior used 'at' parameter,
+ * which was specified in inches.
+ */
 if( name == "at" )
+{
 ret = Get3DCoordinate( child->GetChild( 1 ), m_offset );
+
+if( ret )
+{
+m_offset.x *= 25.4f;
+m_offset.y *= 25.4f;
+m_offset.z *= 25.4f;
+}
+}
+/*
+ * From 5.x onwards, 3D model is provided in 'offset',
+ * which is in millimetres
+ */
+else if( name == "offset" )
+{
+ret = Get3DCoordinate( child->GetChild( 1 ), m_offset );
+}
 else if( name == "scale" )
+{
 ret = Get3DCoordinate( child->GetChild( 1 ), m_scale );
+}
 else if( name == "rotate" )
+{
 ret = GetXYZRotation( child->GetChild( 1 ), 

[Kicad-developers] Fwd: Re: [PATCH] Fix for 3D model offset

2017-11-30 Thread jp charras

 Message transféré 
Sujet : Re: [Kicad-developers] [PATCH] Fix for 3D model offset
Date : Thu, 30 Nov 2017 09:43:05 +0100
De : jp charras 
Répondre à : KiCad Developers 
Pour : Oliver Walters 

Le 30/11/2017 à 08:38, Oliver Walters a écrit :
> JP, Wayne,
> 
> Any update on how we want to handle this?
> 
> On Mon, Nov 27, 2017 at 9:48 PM, Oliver Walters 
>  > wrote:
> 

Hi Oliver,
Could you rebase and rebuild yours patches: they do not apply on current master.

Thanks.


-- 
Jean-Pierre CHARRAS

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp