Skip to content

Commit

Permalink
I made HeeksArt work with the latest HeeksCAD
Browse files Browse the repository at this point in the history
  • Loading branch information
danheeks committed Jun 29, 2010
1 parent 6371907 commit c9ecc2a
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 28 deletions.
19 changes: 14 additions & 5 deletions HeeksArt.cpp
Expand Up @@ -126,7 +126,7 @@ void CHeeksArtApp::OnStartUp(CHeeksCADInterface* h, const wxString& dll_path)
heeksCAD->RegisterReadXMLfunction("mesh", CMesh::ReadFromXMLElement);
}

void CHeeksArtApp::OnNewOrOpen(bool open)
void CHeeksArtApp::OnNewOrOpen(bool open, int res)
{
}

Expand All @@ -146,10 +146,19 @@ void CHeeksArtApp::GetOptions(std::list<Property *> *list){
void CHeeksArtApp::OnFrameDelete()
{
}

const wxString& CHeeksArtApp::GetDllFolder()
{
return m_dll_path;

wxString CHeeksArtApp::GetDllFolder()
{
return m_dll_path;
}

wxString CHeeksArtApp::GetResFolder()
{
#if defined(WIN32) || defined(RUNINPLACE) //compile with 'RUNINPLACE=yes make' then skip 'sudo make install'
return m_dll_path;
#else
return (m_dll_path + _T("/../../share/heekscnc"));
#endif
}

class MyApp : public wxApp
Expand Down
5 changes: 3 additions & 2 deletions HeeksArt.h
Expand Up @@ -20,12 +20,13 @@ class CHeeksArtApp{
~CHeeksArtApp();

void OnStartUp(CHeeksCADInterface* h, const wxString& dll_path);
void OnNewOrOpen(bool open);
void OnNewOrOpen(bool open, int res);
void OnInitDLL();
void OnDestroyDLL();
void GetOptions(std::list<Property *> *list);
void OnFrameDelete();
const wxString& GetDllFolder();
wxString GetDllFolder();
wxString GetResFolder();
};

extern CHeeksArtApp theApp;
Expand Down
4 changes: 2 additions & 2 deletions Interface.cpp
Expand Up @@ -12,9 +12,9 @@ void OnStartUp(CHeeksCADInterface* h, const wxString& dll_path)
theApp.OnStartUp(h, dll_path);
}

void OnNewOrOpen(int open)
void OnNewOrOpen(int open, int res)
{
theApp.OnNewOrOpen(open != 0);
theApp.OnNewOrOpen(open != 0, res);
}

void GetOptions(void(*callbackfunc)(Property*))
Expand Down
2 changes: 1 addition & 1 deletion Interface.h
Expand Up @@ -13,7 +13,7 @@ extern "C"{
#endif

void HEEKSCNC_EXPORT OnStartUp(CHeeksCADInterface* h, const wxString& dll_path);
void HEEKSCNC_EXPORT OnNewOrOpen(int open);
void HEEKSCNC_EXPORT OnNewOrOpen(int open, int res);
void HEEKSCNC_EXPORT GetOptions(void(*callbackfunc)(Property*));
void HEEKSCNC_EXPORT OnFrameDelete();
}
Expand Down
13 changes: 9 additions & 4 deletions Mesh.cpp
Expand Up @@ -41,6 +41,13 @@ const CMesh& CMesh::operator=(const CMesh &m){
return *this;
}

const wxBitmap &CMesh::GetIcon()
{
static wxBitmap* icon = NULL;
if(icon == NULL)icon = new wxBitmap(wxImage(theApp.GetResFolder() + _T("/icons/mesh.png")));
return *icon;
}

void CMesh::DeleteVertices(){
std::map<CMeshPosition, CMeshVertex*>::iterator It;
for(It = m_vertices.begin(); It != m_vertices.end(); It++){
Expand Down Expand Up @@ -202,7 +209,7 @@ HeeksObj *CMesh::MakeACopy(void)const
return new CMesh(*this);
}

bool CMesh::ModifyByMatrix(const double *mat){
void CMesh::ModifyByMatrix(const double *mat){
std::list<CMeshVertex*> vertex_list;

Matrix tmat(mat);
Expand Down Expand Up @@ -243,8 +250,6 @@ bool CMesh::ModifyByMatrix(const double *mat){
}

DestroyChildDisplayLists();

return false;
}

CMeshFace* CMesh::AddTriangle(const Point& a, const Point& b, const Point& c, const Point& ab, const Point& ba, const Point& bc, const Point& cb, const Point& ca, const Point& ac, const Point& centre){
Expand Down Expand Up @@ -404,8 +409,8 @@ class ConvertMeshToTriangles:public Tool{
// Tool's virtual functions
const wxChar* GetTitle(){return _("Convert Mesh To Triangles");}
void Run(){
HeeksObj* new_object = mesh_for_tools->ConvertToTriangles();
heeksCAD->CreateUndoPoint();
HeeksObj* new_object = mesh_for_tools->ConvertToTriangles();
heeksCAD->Add(new_object, NULL);
heeksCAD->Remove(mesh_for_tools);
heeksCAD->Changed();
Expand Down
4 changes: 2 additions & 2 deletions Mesh.h
Expand Up @@ -51,8 +51,8 @@ class CMesh : public HeeksObj
const wxChar* GetTypeString(void)const{return _("Mesh");}
long GetMarkingMask()const{return MARKING_FILTER_UNKNOWN;} // can be selected
HeeksObj *MakeACopy(void)const;
wxString GetIcon(){return theApp.GetDllFolder() + _T("/icons/mesh");}
bool ModifyByMatrix(const double *mat);
const wxBitmap &GetIcon();
void ModifyByMatrix(const double *mat);
void GetTools(std::list<Tool*>* t_list, const wxPoint* p);
bool Stretch(const double *p, const double* shift, void* data);
void Remove(HeeksObj* object);
Expand Down
13 changes: 10 additions & 3 deletions MeshEdge.cpp
Expand Up @@ -28,6 +28,13 @@ CMeshEdge::~CMeshEdge()
{
}

const wxBitmap &CMeshEdge::GetIcon()
{
static wxBitmap* icon = NULL;
if(icon == NULL)icon = new wxBitmap(wxImage(theApp.GetResFolder() + _T("/icons/meshedge.png")));
return *icon;
}

class SplitEdge:public Tool{
public:
CMeshEdge* m_e;
Expand Down Expand Up @@ -138,22 +145,22 @@ void CMeshEdge::GetGripperPositions(std::list<GripData> *list, bool just_for_end
{
for(int i = 0; i<2; i++){
Point vt = m_v[i]->vertex();
list->push_back(GripData(GripperTypeStretch2,vt.x,vt.y,vt.z,NULL));
list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, false, 1));
}
}

// add the control points
{
for(int i = 0; i<2; i++){
Point vt = m_c[i].vertex();
list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL));
list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, true));
}
}

// add a mid point cross for splitting
{
Point vt = GetMidPoint();
list->push_back(GripData(GripperTypeStretch3,vt.x,vt.y,vt.z,NULL));
list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, true, 2));
}
}

Expand Down
2 changes: 1 addition & 1 deletion MeshEdge.h
Expand Up @@ -31,7 +31,7 @@ class CMeshEdge:public CMeshChild
int GetType()const{return MeshEdgeType;}
const wxChar* GetTypeString(void)const{return _("Mesh Edge");}
HeeksObj *MakeACopy(void)const;
wxString GetIcon(){return _T("meshedge");}
const wxBitmap &GetIcon();
void GetTools(std::list<Tool*>* t_list, const wxPoint* p);
void GetGripperPositions(std::list<GripData> *list, bool just_for_endof);
bool Stretch(const double *p, const double* shift, void* data);
Expand Down
13 changes: 10 additions & 3 deletions MeshFace.cpp
Expand Up @@ -19,6 +19,13 @@ CMeshFace::~CMeshFace()
{
}

const wxBitmap &CMeshFace::GetIcon()
{
static wxBitmap* icon = NULL;
if(icon == NULL)icon = new wxBitmap(wxImage(theApp.GetResFolder() + _T("/icons/meshface.png")));
return *icon;
}

class RecalcGoodCentre:public Tool{
public:
CMeshFace* m_f;
Expand Down Expand Up @@ -224,22 +231,22 @@ void CMeshFace::GetGripperPositions(std::list<GripData> *list, bool just_for_end
{
for(int i = 0; i<3; i++){
Point vt = m_v[i]->vertex();
list->push_back(GripData(GripperTypeStretch2,vt.x,vt.y,vt.z,NULL));
list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, false, 1));
}
}

{
for(int i = 0; i<3; i++){
for(int j = 0; j<2; j++){
Point vt = m_e[i]->m_c[j].vertex();
list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL));
list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, true));
}
}
}

{
Point vt = m_centre.vertex();
list->push_back(GripData(GripperTypeStretch4,vt.x,vt.y,vt.z,NULL));
list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, true, 3));
}
}

Expand Down
2 changes: 1 addition & 1 deletion MeshFace.h
Expand Up @@ -32,7 +32,7 @@ class CMeshFace:public CMeshChild
int GetType()const{return MeshFaceType;}
const wxChar* GetTypeString(void)const{return _("Mesh Face");}
HeeksObj *MakeACopy(void)const;
wxString GetIcon(){return _T("meshedge");}
const wxBitmap &GetIcon();
void GetGripperPositions(std::list<GripData> *list, bool just_for_endof);
void GetTools(std::list<Tool*>* t_list, const wxPoint* p);
bool Stretch(const double *p, const double* shift, void* data);
Expand Down
11 changes: 9 additions & 2 deletions MeshVertex.cpp
Expand Up @@ -33,6 +33,13 @@ HeeksObj *CMeshVertex::MakeACopy(void)const
return new CMeshVertex(*this);
}

const wxBitmap &CMeshVertex::GetIcon()
{
static wxBitmap* icon = NULL;
if(icon == NULL)icon = new wxBitmap(wxImage(theApp.GetResFolder() + _T("/icons/meshvertex.png")));
return *icon;
}

class NormalizeAllEdgeDirections:public Tool{
public:
CMeshVertex* m_vertex;
Expand Down Expand Up @@ -154,14 +161,14 @@ void CMeshVertex::NormalizeAllEdgeDirections(){
void CMeshVertex::GetGripperPositions(std::list<GripData> *list, bool just_for_endof){
// vertex
Point vt = vertex();
list->push_back(GripData(GripperTypeStretch2,vt.x,vt.y,vt.z,NULL));
list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, false, 1));

for(std::set<CMeshEdge*>::iterator It = m_edges.begin(); It != m_edges.end(); It++)
{
CMeshEdge* edge = *It;
CMeshPosition& p = edge->GetControlPointNearVertex(this);
vt = p.vertex();
list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL));
list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, true, 0));
}
}

Expand Down
2 changes: 1 addition & 1 deletion MeshVertex.h
Expand Up @@ -37,7 +37,7 @@ class CMeshVertex:public CMeshChild
int GetType()const{return MeshVertexType;}
const wxChar* GetTypeString(void)const{return _("Mesh Vertex");}
HeeksObj *MakeACopy(void)const;
wxString GetIcon(){return _T("meshedge");}
const wxBitmap &GetIcon();
void GetTools(std::list<Tool*>* t_list, const wxPoint* p);
void GetGripperPositions(std::list<GripData> *list, bool just_for_endof);
bool Stretch(const double *p, const double* shift, void* data);
Expand Down
25 changes: 24 additions & 1 deletion bitmaps/bitmaps.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bitmaps/meshvertex.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c9ecc2a

Please sign in to comment.