Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
b4480408
Commit
b4480408
authored
Apr 19, 2010
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pcbnew: Added VRML export, from the patch sent by Lorenzo Marcantonio ( october 2009, 11)
parent
8dd76c53
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
66 deletions
+76
-66
build_version.cpp
common/build_version.cpp
+1
-1
dialog_export_3Dfiles_base.cpp
pcbnew/dialog_export_3Dfiles_base.cpp
+2
-2
dialog_export_3Dfiles_base.fbp
pcbnew/dialog_export_3Dfiles_base.fbp
+3
-3
dialog_export_3Dfiles_base.h
pcbnew/dialog_export_3Dfiles_base.h
+1
-1
export_vrml.cpp
pcbnew/export_vrml.cpp
+69
-59
No files found.
common/build_version.cpp
View file @
b4480408
...
...
@@ -6,7 +6,7 @@
#endif
#ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2010-04-1
3
BZR 23xx)"
#define KICAD_BUILD_VERSION "(2010-04-1
9
BZR 23xx)"
#endif
#define VERSION_STABILITY "unstable"
...
...
pcbnew/dialog_export_3Dfiles_base.cpp
View file @
b4480408
...
...
@@ -20,14 +20,14 @@ DIALOG_EXPORT_3DFILE_BASE::DIALOG_EXPORT_3DFILE_BASE( wxWindow* parent, wxWindow
bUpperSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
bUpperSizer
->
SetMinSize
(
wxSize
(
450
,
-
1
)
);
m_staticText1
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"
W
rml main file filename:"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticText1
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"
V
rml main file filename:"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticText1
->
Wrap
(
-
1
);
bUpperSizer
->
Add
(
m_staticText1
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
m_filePicker
=
new
wxFilePickerCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
_
(
"Save VRML Board File"
),
wxT
(
"*.wrl"
),
wxDefaultPosition
,
wxDefaultSize
,
wxFLP_DEFAULT_STYLE
|
wxFLP_SAVE
);
bUpperSizer
->
Add
(
m_filePicker
,
0
,
wxBOTTOM
|
wxRIGHT
|
wxLEFT
|
wxEXPAND
,
5
);
m_staticText3
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"
W
rml 3D footprints shapes subdir:"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticText3
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"
V
rml 3D footprints shapes subdir:"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticText3
->
Wrap
(
-
1
);
bUpperSizer
->
Add
(
m_staticText3
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
...
...
pcbnew/dialog_export_3Dfiles_base.fbp
View file @
b4480408
...
...
@@ -35,7 +35,7 @@
<property
name=
"size"
>
370,252
</property>
<property
name=
"style"
>
wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
</property>
<property
name=
"subclass"
></property>
<property
name=
"title"
></property>
<property
name=
"title"
>
Vrml Board Export Options:
</property>
<property
name=
"tooltip"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_name"
></property>
...
...
@@ -96,7 +96,7 @@
<property
name=
"font"
></property>
<property
name=
"hidden"
>
0
</property>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"label"
>
W
rml main file filename:
</property>
<property
name=
"label"
>
V
rml main file filename:
</property>
<property
name=
"maximum_size"
></property>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
m_staticText1
</property>
...
...
@@ -200,7 +200,7 @@
<property
name=
"font"
></property>
<property
name=
"hidden"
>
0
</property>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"label"
>
W
rml 3D footprints shapes subdir:
</property>
<property
name=
"label"
>
V
rml 3D footprints shapes subdir:
</property>
<property
name=
"maximum_size"
></property>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
m_staticText3
</property>
...
...
pcbnew/dialog_export_3Dfiles_base.h
View file @
b4480408
...
...
@@ -51,7 +51,7 @@ class DIALOG_EXPORT_3DFILE_BASE : public wxDialog
public
:
DIALOG_EXPORT_3DFILE_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
wxEmptyString
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
370
,
252
),
long
style
=
wxDEFAULT_DIALOG_STYLE
|
wxRESIZE_BORDER
);
DIALOG_EXPORT_3DFILE_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
_
(
"Vrml Board Export Options:"
)
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
370
,
252
),
long
style
=
wxDEFAULT_DIALOG_STYLE
|
wxRESIZE_BORDER
);
~
DIALOG_EXPORT_3DFILE_BASE
();
};
...
...
pcbnew/export_vrml.cpp
View file @
b4480408
...
...
@@ -14,6 +14,73 @@
#include <cmath>
/* the dialog to create VRML files, derived from DIALOG_EXPORT_3DFILE_BASE,
* created by wxFormBuilder
*/
#include "dialog_export_3Dfiles_base.h" // the wxFormBuilder header file
#define OPTKEY_OUTPUT_UNIT wxT("VrmlExportUnit" )
#define OPTKEY_3DFILES_OPT wxT("VrmlExport3DShapeFilesOpt" )
class
DIALOG_EXPORT_3DFILE
:
public
DIALOG_EXPORT_3DFILE_BASE
{
private
:
WinEDA_PcbFrame
*
m_parent
;
wxConfig
*
m_config
;
int
m_unitsOpt
;
// to remember last option
int
m_3DFilesOpt
;
// to remember last option
virtual
void
OnCancelClick
(
wxCommandEvent
&
event
){
EndModal
(
wxID_CANCEL
);
}
virtual
void
OnOkClick
(
wxCommandEvent
&
event
){
EndModal
(
wxID_OK
);
}
public
:
DIALOG_EXPORT_3DFILE
(
WinEDA_PcbFrame
*
parent
)
:
DIALOG_EXPORT_3DFILE_BASE
(
parent
)
{
m_parent
=
parent
;
m_config
=
wxGetApp
().
m_EDA_Config
;
SetFocus
();
m_config
->
Read
(
OPTKEY_OUTPUT_UNIT
,
&
m_unitsOpt
);
m_config
->
Read
(
OPTKEY_3DFILES_OPT
,
&
m_3DFilesOpt
);
m_rbSelectUnits
->
SetSelection
(
m_unitsOpt
);
m_rb3DFilesOption
->
SetSelection
(
m_3DFilesOpt
);
GetSizer
()
->
SetSizeHints
(
this
);
Centre
();
}
~
DIALOG_EXPORT_3DFILE
()
{
m_unitsOpt
=
GetUnits
(
);
m_3DFilesOpt
=
Get3DFilesOption
(
);
m_config
->
Write
(
OPTKEY_OUTPUT_UNIT
,
m_unitsOpt
);
m_config
->
Write
(
OPTKEY_3DFILES_OPT
,
m_3DFilesOpt
);
};
void
SetSubdir
(
const
wxString
&
aDir
)
{
m_SubdirNameCtrl
->
SetValue
(
aDir
);
}
wxString
GetSubdir
(
)
{
return
m_SubdirNameCtrl
->
GetValue
(
);
}
wxFilePickerCtrl
*
FilePicker
()
{
return
m_filePicker
;
}
int
GetUnits
(
)
{
return
m_unitsOpt
=
m_rbSelectUnits
->
GetSelection
();
}
int
Get3DFilesOption
(
)
{
return
m_3DFilesOpt
=
m_rb3DFilesOption
->
GetSelection
();
}
};
/* I use this a lot... */
static
const
double
PI2
=
M_PI
/
2
;
...
...
@@ -1037,63 +1104,6 @@ static void write_and_empty_triangle_bag( FILE* output_file,
}
/* the dialog to create VRML files, derived from DIALOG_EXPORT_3DFILE_BASE,
* created by wxFormBuilder
*/
#include "dialog_export_3Dfiles_base.h" // the wxFormBuilder header file
class
DIALOG_EXPORT_3DFILE
:
public
DIALOG_EXPORT_3DFILE_BASE
{
private
:
static
int
m_UnitsOpt
;
// to remember last option
static
int
m_3DFilesOpt
;
// to remember last option
virtual
void
OnCancelClick
(
wxCommandEvent
&
event
){
EndModal
(
wxID_CANCEL
);
}
virtual
void
OnOkClick
(
wxCommandEvent
&
event
){
EndModal
(
wxID_OK
);
}
public
:
DIALOG_EXPORT_3DFILE
(
wxWindow
*
parent
)
:
DIALOG_EXPORT_3DFILE_BASE
(
parent
)
{
SetFocus
();
m_rbSelectUnits
->
SetSelection
(
m_UnitsOpt
);
m_rb3DFilesOption
->
SetSelection
(
m_3DFilesOpt
);
GetSizer
()
->
SetSizeHints
(
this
);
Centre
();
}
~
DIALOG_EXPORT_3DFILE
()
{
m_UnitsOpt
=
GetUnits
(
);
m_3DFilesOpt
=
Get3DFilesOption
(
);
};
void
SetSubdir
(
const
wxString
&
aDir
)
{
m_SubdirNameCtrl
->
SetValue
(
aDir
);
}
wxString
GetSubdir
(
)
{
return
m_SubdirNameCtrl
->
GetValue
(
);
}
wxFilePickerCtrl
*
FilePicker
()
{
return
m_filePicker
;
}
int
GetUnits
(
)
{
return
m_UnitsOpt
=
m_rbSelectUnits
->
GetSelection
();
}
int
Get3DFilesOption
(
)
{
return
m_3DFilesOpt
=
m_rb3DFilesOption
->
GetSelection
();
}
};
int
DIALOG_EXPORT_3DFILE
::
m_UnitsOpt
=
0
;
// to remember last option
int
DIALOG_EXPORT_3DFILE
::
m_3DFilesOpt
=
1
;
// to remember last option
/**
* Function OnExportVRML
* will export the current BOARD to a VRML file.
...
...
@@ -1186,8 +1196,8 @@ bool WinEDA_PcbFrame::ExportVRML_File( const wxString & aFullFileName,
* more easy for rotations...
*/
pcb
->
ComputeBoundaryBox
();
double
dx
=
board_scaling_factor
*
pcb
->
m_BoundaryBox
.
Centre
().
x
;
double
dy
=
board_scaling_factor
*
pcb
->
m_BoundaryBox
.
Centre
().
y
;
double
dx
=
board_scaling_factor
*
pcb
->
m_BoundaryBox
.
Centre
().
x
*
aScale
;
double
dy
=
board_scaling_factor
*
pcb
->
m_BoundaryBox
.
Centre
().
y
*
aScale
;
fprintf
(
output_file
,
" translation %g %g 0.0
\n
"
,
-
dx
,
dy
);
fprintf
(
output_file
,
" children [
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment