Skip to content

Commit aae7402

Browse files
author
salamb
committed
Create a full mirror of a given workplan and append it to the original STPNC
project. Uses MT connect data for feeds and stpnc file to fill in rapid paths
1 parent 9019efd commit aae7402

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

Patcher.cpp

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,13 @@ void Patcher::patchRapid(List<long long>^ pathList,STEPNCLib::AptStepMaker ^ apt
467467
apt->Workingstep("starting Feed");
468468
}
469469

470+
471+
void Patcher::debugOut(STEPNCLib::AptStepMaker^apt, STEPNCLib::Finder^ find,double feed) {
472+
473+
Console::WriteLine("feed {0}", feed);
474+
475+
}
476+
470477
//given a stpnc file and a workplan within the stepnc file
471478
// append a workplan with tool paths genereated from the xml data
472479
//that contains tool position
@@ -475,7 +482,7 @@ void Patcher::patchRapid(List<long long>^ pathList,STEPNCLib::AptStepMaker ^ apt
475482
void Patcher::appendPatchWorkPlan(String^partFile,String^coorFile,String^outName,String^ path,bool toInches ){
476483
Console::WriteLine("input \n part {0}\n xml file{1} \n path to desired workplan {2}",partFile,coorFile,path);
477484
//assume all units are inches or inches per sec
478-
double max_feed=.8;//inches per sec
485+
double max_feed=.3;//inches per sec
479486
//get path position coordinates from the xml file with delta t in seconds at end
480487

481488

@@ -524,18 +531,19 @@ void Patcher::appendPatchWorkPlan(String^partFile,String^coorFile,String^outName
524531
String ^str;
525532
array<double>^ coor1;
526533
array<double>^coor2;
527-
534+
528535
bool startRapid=false;
529536
bool currentCoorisRapid=true;
530537
int currentTransition=0;
538+
__int64 debugStep;
531539
//Console::WriteLine("number of path coordinates {0}",coorList->Count);
532540
//Console::WriteLine("number of transitions {0}",transitionPaths->Count);
533541
//determine if starting position is in rapid mode or feed
534542
if(sample->getSize()>1){
535543
coor1 = sample->getCoor(0);
536544
coor2= sample->getCoor(1);
537-
538-
if (actualFeedRate(coor1,coor2)>max_feed){
545+
546+
if (actualFeedRate(coor1, coor2)>max_feed){
539547
currentCoorisRapid=true;
540548

541549

@@ -547,6 +555,8 @@ void Patcher::appendPatchWorkPlan(String^partFile,String^coorFile,String^outName
547555
if(currentCoorisRapid){
548556
apt->Rapid();
549557
}else{
558+
559+
550560
apt->Feedrate(max_feed);
551561
}
552562
}
@@ -578,7 +588,14 @@ void Patcher::appendPatchWorkPlan(String^partFile,String^coorFile,String^outName
578588
}
579589

580590
}else if(currentCoorisRapid==false){
581-
591+
debugStep = apt->GetCurrentWorkingstep();
592+
if (find->GetWorkingstepName2(debugStep)->Contains("WS 24")) {
593+
Console::WriteLine("WS {0}", find->GetWorkingstepName2(debugStep));
594+
debugOut(apt, find, actualFeed);
595+
596+
}
597+
598+
582599
startRapid=false;
583600
apt->GoToXYZ("feed",coor2[0],coor2[1],coor2[2]);
584601
}
@@ -744,13 +761,13 @@ void Patcher::createPatchedFile(String^ partFile,String^ WPpath,String^newFileNa
744761

745762

746763

747-
if (!prevCoorIsRapid) {
764+
if (!prevCoorIsRapid&&isFeedState(pastRapids,3)) {
748765

749766
apt->Feedrate(currentTP->getWS()->getMaxFeed());
750767

751768
apt->SpindleSpeed(currentTP->getWS()->getMaxSpindle());
752769
apt->GoToXYZ("feed", coor2[0], coor2[1], coor2[2]);
753-
}else if(prevCoorIsRapid&&!pastRapids[pastRapids->Count-2]) {
770+
}else if(rapidStarted(pastRapids)) {
754771

755772
currentTP = patchRapidToolPaths(apt, find, currentTP);
756773

@@ -847,15 +864,15 @@ ToolPath ^tp2 = nullptr;
847864
Console::WriteLine(" Transitioned to a new WS without rapiding");
848865
}
849866
}
850-
867+
/*
851868
if (tp1->getWS()->getIndex() >= 9) {
852869
apt->Workingstep("Rapiding");
853870
854-
}
871+
}*/
855872
List<__int64> ^temp = gcnew List<__int64>();
856873
temp->Add(tp1->getId());
857874
List<double> ^loc = getAllPoints(temp, find);
858-
Console::WriteLine("rapid starting at WS {0} index {1} coor {2} {3} {4}", tp1->getWS()->getName(), tp1->getIndex(), loc[0], loc[1], loc[2]);
875+
//Console::WriteLine("rapid starting at WS {0} index {1} coor {2} {3} {4}", tp1->getWS()->getName(), tp1->getIndex(), loc[0], loc[1], loc[2]);
859876
while (tp1->rapid())
860877
{
861878
STPNCpath->Add(tp1->getId());
@@ -878,11 +895,12 @@ ToolPath ^tp2 = nullptr;
878895
}
879896
tp1 = tp2;
880897
}
898+
/*
881899
if (tp1->getWS()->getIndex() >= 9) {
882900
apt->Workingstep("Feed");
883901
884902
}
885-
903+
*/
886904
return tp1;
887905
}
888906
/*

Patcher.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ ref class Patcher{
5757
void rapidToPoints(STEPNCLib::AptStepMaker^apt, STEPNCLib::Finder ^ find, List<__int64>^STPNCpath);
5858
bool rapidStarted(List<bool>^ state);
5959
bool isFeedState(List<bool>^state, int count);
60+
void debugOut(STEPNCLib::AptStepMaker^apt, STEPNCLib::Finder^ find,double feed);
6061
};
6162
#endif

stepnc_hello.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,9 @@ int main(int argc, char * argv[])
441441
//appendToFile("sample_300ms.xml","hardmoldy_ext.stpnc","moldy_300.stpnc",true);
442442
//appendPatchWorkPlan("hardmoldy_ext.stpnc","sample_300ms.xml","patched_300.stpnc","HARDMOLDY/Profiling/Boeing",true);
443443

444-
//pat->createPatchedFile("hardmoldy_imts_signed.stpnc", "HARDMOLDY", "patchedMoldy", "PatchWP", "Data.txt");
444+
pat->createPatchedFile("hardmoldy_imts_signed.stpnc", "HARDMOLDY", "patchedMoldy", "PatchWP", "Data.txt");
445445
//pat->appendToFile("Data.txt", "hardmoldy_imts_signed.stpnc", "patchedMoldy", true);
446-
pat->appendPatchWorkPlan("hardmoldy_imts_signed.stpnc", "Data.txt", "moldySeperated", "HARDMOLDY/Profiling/Boeing", true);
446+
//pat->appendPatchWorkPlan("hardmoldy_imts_signed.stpnc", "Data.txt", "moldySeperated", "HARDMOLDY/Profiling/Boeing", true);
447447
Console::WriteLine("done");
448448
String ^readIn =Console::ReadLine();
449449
return 0;

0 commit comments

Comments
 (0)