×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Custom CAM toolpaths in siemens NX

Custom CAM toolpaths in siemens NX

Custom CAM toolpaths in siemens NX

(OP)
Hello everyone.

I've been searching some sample codes that can provide examples about drpos, dpud, udop functions, used to create custom toolpaths in siemens NX. I need a code that provide information about use of selected geometries used to create reference for the toolpath which will be created. Follow a code that i created on java to use DPUD function, but i found some problemns, like a infinity loop on generate the operation. Someone can help me?

CODE

public static int dpud(String[] args) throws Exception, NXException {
        int retorno=0;
        initvar();
        UFVariant udpud;
        UFVariant operptr;
        UFVariant udrpos1, udrpos2, udrpos0;
        UFDpud.Purpose purpose;
        String opname;
        UFVariant pathptr;
        Tag operacao = null;


        udpud = theufsession.dpud().askDpud(null);
        operptr = theufsession.dpud().askOper(udpud);
        purpose = theufsession.dpud().askPurpose(udpud);
        opname = theufsession.oper().askName(operptr);
        pathptr = theufsession.oper().askPath(operptr);
        operacao = theufsession.obj().cycleByName(opname, operacao);
        //udrpos0 = theufsession.dpud().askDrpos0(udpud);
        //udrpos1 = theufsession.dpud().askDrpos1(udpud);
        //udrpos2 = theufsession.dpud().askDrpos2(udpud);

        
        
        

        if (purpose == UFDpud.Purpose.USER_PARAMS) {
            theufsession.ui().openListingWindow();
            theufsession.ui().writeListingWindow("USER PARAMS" + "\n");
            theufsession.ui().writeListingWindow("NOME DA OPERACAO: " + opname + "\n");
            theufsession.ui().writeListingWindow("TAG NUMBER : " + operacao + "\n");
            theufsession.ui().writeListingWindow("TAG NAME   : " + theufsession.obj().askName(operacao) + "\n");
            purposeopen();
        } else {
            theufsession.ui().openListingWindow();
            theufsession.ui().writeListingWindow("generate drpos" + "\n");
            //retorno = -1;
        }

        
       
        
        /*
         if (purpose == UFDpud.Purpose.REWIND) {
         theufsession.ui().openListingWindow();
         theufsession.ui().writeListingWindow("REWIND" + "\n");
         }


         if (purpose == UFDpud.Purpose.STOP_PROCESSOR) {
         theufsession.ui().openListingWindow();
         theufsession.ui().writeListingWindow("PAROU A DO PROCESSAMENTO" + "\n");
         }

         if (purpose == UFDpud.Purpose.TAXIS_PARAMS) {
         theufsession.ui().openListingWindow();
         theufsession.ui().writeListingWindow("TAXIS PARAMETERS" + "\n");
         }


         if (purpose == UFDpud.Purpose.PROJ_PARAMS) {
         theufsession.ui().openListingWindow();
         theufsession.ui().writeListingWindow("PROJ PARAMS" + "\n");
         }


         if (purpose == UFDpud.Purpose.INIT_PROCESSOR) {
         theufsession.ui().openListingWindow();
         theufsession.ui().writeListingWindow("INIT PROCESSOR" + "\n");


         //theufsession.param().generate(operacao);


         theufsession.ui().writeListingWindow("GERADO COM SUCESSO" + "\n");

            

         }
         //*/




        return retorno;
    } 

RE: Custom CAM toolpaths in siemens NX

(OP)
Dr. Mark Rief

Thanks for your repply.

I searched on GTAC Symptom/Solution Database, but i not found a sample code or a sample file that can provide information about dpud and drpos. Only about UDOP. I searched too on the forum that you had recomended, but i dont found what i need.

can you provide me some sample code with dpud, drpos, and another functions to create custom toolpaths on NX that i need?

Thanks for your attention

RE: Custom CAM toolpaths in siemens NX

(OP)
Someone can help me?

RE: Custom CAM toolpaths in siemens NX

(OP)
Someone can help me?

Please?

RE: Custom CAM toolpaths in siemens NX

dpud is not so well documented.

you need to add handling for GET_NEXT and GET_INTERMEDIATE
You might get a clue from this..
[code ]
} else if (purpose == nxopen.uf.UFDpud.Purpose.GET_NEXT) {
double proj[] = {0.0,0.0,-1.0};
drpos0 = dpSess.askDrpos0(dpudPtr);
coord = path.getNextCoord();
if(coord==null){
ufDrPos.createFinalLift(drpos0);
}else{
pos[0] = coord.x;
pos[1] = coord.y;
pos[2] = coord.z;
ufDrPos.setPosition(drpos0, pos);
if(id==0){
ufDrPos.setProjVec(drpos0, proj);
ufDrPos.createFirstCut(drpos0, pos, dir);
}
else{
ufDrPos.createCut(drpos0, pos, dir);
}
}
id++;
} else if (purpose == nxopen.uf.UFDpud.Purpose.GET_INTERMEDIATE) {
UFVariant drpos1 = null;
UFVariant drpos2 = null;
// System.out.println("purpose GET_INTERMEDIATE");
final double ratio = dpSess.askRatio(dpudPtr);
drpos1 = dpSess.askDrpos1(dpudPtr);
drpos2 = dpSess.askDrpos2(dpudPtr);
double[] pos1 = ufDrPos.askPosition(drpos1);
double[] pos2 = ufDrPos.askPosition(drpos2);
double deltaX = pos2[0] - pos1[0];
double deltaY = pos2[1] - pos1[1];
double deltaZ = pos2[2] - pos1[2];
double midpos[] = new double[3];
midpos[0] = deltaX * ratio + pos1[0];
midpos[1] = deltaY * ratio + pos1[1];
midpos[2] = deltaZ * ratio + pos1[2];
drpos0 = dpSess.askDrpos0(dpudPtr);
ufDrPos.setPosition(drpos0, midpos);
id++;
} else if (purpose == nxopen.uf.UFDpud.Purpose.REWIND) {
System.out.println("purpose REWIND");
} else if (purpose == nxopen.uf.UFDpud.Purpose.STOP_PROCESSOR) {
System.out.println("purpose STOP_PROCESSOR");
id=-1;
// must unload so NX don't crash
unloadType = BaseSession.LibraryUnloadOption.IMMEDIATELY;
} else {
System.out.println("Purpose ??");
}
[/code]

RE: Custom CAM toolpaths in siemens NX

Wrong formatting in my last post

CODE -->

} else if (purpose == nxopen.uf.UFDpud.Purpose.GET_NEXT) {
            double proj[] = {0.0,0.0,-1.0};
        	drpos0 = dpSess.askDrpos0(dpudPtr);
            coord = path.getNextCoord();
            if(coord==null){
	        	ufDrPos.createFinalLift(drpos0);
            }else{
                pos[0] = coord.x;
                pos[1] = coord.y;
                pos[2] = coord.z;
                ufDrPos.setPosition(drpos0, pos);
                if(id==0){
                	ufDrPos.setProjVec(drpos0, proj);
                	ufDrPos.createFirstCut(drpos0, pos, dir);
                	}
                else{
                	ufDrPos.createCut(drpos0, pos, dir);
                }
            }
            id++;
        } else if (purpose == nxopen.uf.UFDpud.Purpose.GET_INTERMEDIATE) {
            UFVariant drpos1 = null;
            UFVariant drpos2 = null;
//            System.out.println("purpose GET_INTERMEDIATE");
            final double ratio = dpSess.askRatio(dpudPtr);
            drpos1 = dpSess.askDrpos1(dpudPtr);
            drpos2 = dpSess.askDrpos2(dpudPtr);
            double[] pos1 = ufDrPos.askPosition(drpos1);
            double[] pos2 = ufDrPos.askPosition(drpos2);
            double deltaX = pos2[0] - pos1[0];
            double deltaY = pos2[1] - pos1[1];
            double deltaZ = pos2[2] - pos1[2];
            double midpos[] = new double[3];
            midpos[0] = deltaX * ratio + pos1[0];
            midpos[1] = deltaY * ratio + pos1[1];
            midpos[2] = deltaZ * ratio + pos1[2];
            drpos0 = dpSess.askDrpos0(dpudPtr);
            ufDrPos.setPosition(drpos0, midpos);
            id++;
        } else if (purpose == nxopen.uf.UFDpud.Purpose.REWIND) {
            System.out.println("purpose REWIND");
        } else if (purpose == nxopen.uf.UFDpud.Purpose.STOP_PROCESSOR) {
            System.out.println("purpose STOP_PROCESSOR");
            id=-1;
            // must unload so NX don't crash
            unloadType = BaseSession.LibraryUnloadOption.IMMEDIATELY;
        } else {
        	System.out.println("Purpose ??");
        } 

RE: Custom CAM toolpaths in siemens NX

(OP)
KariH, Hello my friend..

Very thanks for your collaboration...

You save me

you solve all my problems...Thanks a lot

RE: Custom CAM toolpaths in siemens NX

(OP)
KariH, please, can you provide me the an example to use a surface or a line as guide to an operation ??

as example, can i use a surface like a drive or make a contour like mill contour multi axis operation??

I wait anxious your help...

RE: Custom CAM toolpaths in siemens NX

Marcoantoniosilva
I don't have any simple example but as you see in my code I have a object named path. It is created from a NX curve. The curve is divided into small segments depending on the resolution I need. Each time I call (or actually NX calls with Purpose.GET_NEXT) path.getNextCoord() it will return the coordinates of the start of the next segment. These coordinates are used to to set the drivegeometry with ufDrPos.setPosition(), when there are no more coordinates i run ufDrPos.createFinalLift()

NX will continue to call the dpud until you run ufDrPos.createFinalLift() if you don't do that you will end up with a infinite loop.

I have never tryed to use surfaces as drive..

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources