Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Zaffin_D

Verified Members
  • Posts

    374
  • Joined

  • Days Won

    1

Posts posted by Zaffin_D

  1. 		if (tabison)
    		{
    			cntrop->Tabs.AutomaticPosition = true;
    
    			cntrop->Tabs.TabAll = true;
    
    			cntrop->Tabs.Enabled = true;
    
    			cntrop->Tabs.AutoTabByDistance = false;
    
    			cntrop->Tabs.NumberOfTabs = 4;
    
    			cntrop->Tabs.EntryExitMode = Mastercam::Operations::Types::TabEntryExitType::Vertical;
    
    			cntrop->Tabs.TabThickness = 0.04;
    
    			cntrop->Tabs.TabWidth = 0.1;
    		}
    		if (!tabison)
    		{
    			cntrop->Tabs.Enabled = false;
    		
    		}

    Sorry, this just struck me funny!

    I only want to write C++ when I have to; I'd much rather handle everything in C# and create a native .dll only if needed.  This is likely because I know nothing about MFC so any interface I create will be WPF.  

  2. On 12/31/2019 at 5:54 PM, PcRobotic said:

    pCheckHolderName
        sHolderName = opinfo(20020, 0)

        if sHolderName = sDefaultHolderName,
            [
            #//Throw an error
            #op_number = opinfo(15240, 0)
            if strstr ("PRODUCTION", sMaterialCommentExt) | 
               strstr ("TIGHT", sMaterialCommentExt) | 
               strstr ("COSMETIC", sMaterialCommentExt) |
               strstr ("PROTOTYPE", sMaterialCommentExt), [if mprint(sHolderCheck, 2) = 2, exitpost$] #
            ]

    For what it's worth, this is something I would consider bad practice.  The postblock is called pCheckHolderName but it checks the holder name and a bunch of other, unrelated conditions.

    • Thanks 1
  3. 15 hours ago, Compaq007 said:

    I am planning to have the user pick a point using the Visual Script from MasterCAM interface then pass the x,y & z info to the net-hook and have the net-hook do the translation then return the values back to the Visual Script..

     

     

    This sounds like alot more work than just using a NET-Hook to do everything.

    I threw together a quick sample last night; it should give you an idea of what's possible.

    And even though I think you should use a NET-Hook to do this, if you can get a view's matrix in VBScript you can map a point.  Multiplying a point's X, Y, and Z by view's matrix will give you the X, Y, and Z relative to that view.

    • Like 1
  4. I started working on your BreakSplines function and the following condition jumped out at me.

    	if (entity.id == S_ID || entity.id == NB_ID)

    This is unnecessary; S_ID and NB_ID are binary so we can use the bitwise operators and simplify things.

    	if (entity.id & (S_ID | NB_ID))

    Or, we can just use the SPLINE_ID definition from BaseDefines_CH.h

    #define SPLINE_ID	(S_ID | NB_ID)	//!< Spline:  parametric or NURBS
    	if (entity.id & SPLINE_ID)

     

  5. On 12/18/2019 at 5:30 AM, content creator said:

    I wasn't trying to give that impression 😕 I want to learn..I was just giving my point of view, anyway thanks for your comments.. good luck to you. 

    I wasn't trying to be short; you just seem to be in a "I need this to work" situation and not a "I need this to work AND be maintainable, well organized, etc." situation.  Take everything you read below with a grain of salt; I'm largely self-taught and this is not my field of expertise.      

     

    Anyway, I took a look at your code over the holiday break.  At this point I only have a few of your functions refactored; if time allows I’ll do more.   

    I made this a CLI/CLR project with a WPF interface so I could quickly test everything.  I also moved to a more traditional project layout with definitions in the header files and implementations in the source files.    

    The first thing I noticed is that you have two functions that do almost the same thing; BlankAllNonSolidEnts and UnBlankAllNonSolidEnts.  I merged BlankAllNonSolidEnts and UnBlankAllNonSolidEnts into one method BlankUnblankAllNonSolids. 

    int APIToolsNative::APITools::BlankUnblankAllNonSolids(bool unblank)
    {
    	int numberOfEntitesModified = 0;
    
    	auto entityPointer = db_start;
    
    	while (entityPointer != nullptr) 
    	{	
    		if (entityPointer->eptr->id != SOLID_ID)
    		{	
    			numberOfEntitesModified++;
    
    			if (unblank)
    			{
    				sel_bit_turn_off(entityPointer->eptr, BLANK_BIT);
    				entityPointer->eptr->color = MC_RED;
    			}
    			else
    			{
    				sel_bit_turn_on(entityPointer->eptr, BLANK_BIT);
    			}
    
    			write_ent_sel(entityPointer->eptr, entityPointer->eptr->eptr);
    		}
    
    		entityPointer = entityPointer->next;
    	}
    
    	if (numberOfEntitesModified > 0)
    		repaint_graphics();
    
    	return numberOfEntitesModified;
    }

    In addition to combining the functions, I went with a while loop to traverse the linked list.

    You can review everything I’ve done on my GitHub 

    Hope that helps.

  6. 7 hours ago, cncappsjames said:

    I don't know that my way is the "best" way, and I'm sure there's a faster way but it gets me to within .0001 or better every time; 

    1. Using a tape measure or scale, I estimate the length of the probe (to the tip) and add a "little" :) and put that value in the probe's length geometry offset. 
    2.  Taking your known length tool, set your G54 (or an open offset) to the top of a FLAT easily accessible surface. I use a 4" gage block so I dont move Z and compress the bearings, and I can make my offset good wo within .0001"
    3. Call your probe into the spindle. 
    4. Activate G54 (or the work offset  you used)
    5. "Measure" that Z surface you set your work offset to with a probing cycle. No S value on the probe cycle line. Whatever you do, DO NOT reset that surface as your Work Offset Z Zero or you need to go back to step 2.  
    6. Once you "measure" that surface, you will have an "error" value in one of them. Not being a Haas guy I don;t know what your variables are (on a FANUC it would be #142).
    7. Put that error value in your probe's length offset "WEAR" column.
    8. Measure again. The error should be 0 or maybe .0001" or so.
    9. If that was the case, add the value in your wear column to your geometry column and clear the WEAR offset. 
    10. Measure one more time. The error should be within .0001" of what it was in the previous measure's error. 

    Again, not saying my way is the best way, this is just the most foolproof way I figured out BITD when I was learning.

    The reason I do not use the tool measurement system to set probe length offsets is because 1) If it is touch style tool measurement system, you will get the probe's length without taking into account the deflection/trigger point in Z so measurements would be a little off.  2)If the measurement system is laser, there's virtually no chance of getting a good offset because spinning the probe at normal tool measurement RPM's will destroy a probe or the ruby will deflect the laser beam and give an erroneous measurement. 

    Hope this helps.  

    My process was much the same, with a slight modification. 

    I would calibrate the laser, the measure a new tool in a good holder.  With the measured tool I would then cut a flat on a sacrificial block of material, set the datum, and calibrate the probe on the newly machined flat. 

    This process made sure that to tool setter and the probe agreed.   

    • Like 1
  7. To generate the ASCII NCI, enable the check box shown below in the Post processing dialog

    image.png.27566d738ba6fe32ec0b563166731f7b.png

    In my example part, the ASCII NCI looks like this;

    image.png.97118188bbd5735d76da7f2b8cdc13f4.png

    I've highlighted the feed rate values for clarity;

    • -2 = Rapid move
    • -1 = Feed rate has not changed
    • Any positive value = feed rate in UPM

    The first thing you should do is make sure the reduced feed rate is being output in the NCI.

  8. I put about half an hour into the below solution; it's worth about the time I put into it...

      FileLocker.png.256c6cecdcda57a9f4b36707643d7bfe.png

    It sets and resets the Windows 'Read-only' attribute of the current Mastercam file.  When you attempt to save a Mastercam file that's has it's 'Read-only' attribute set you get the below error message.

     error.png.1734bb2d62d05437345a7c2ab1cba2a1.png

     

    Attached is a .zip archive containing the .dll and .ft files.  Make sure that the .dll is unblocked, then copy it and the .ft file to Mastercam's Chooks folder.  The source can be found on my GitHub.  

    FileLocker1_0.zip

    • Like 2
  9. 2 hours ago, peter ~ said:

    It was set to private, you may access now!

    Yes, the links work now. Sorry for the delay, I've been working on my own projects as of late.

    Honestly I'm not sure where to begin with the native project, it's in quite a state.  Is there a reason you defined and implemented functions in the header files?  You're also allocating memory on the heap and never freeing it; that's less than ideal.

    I'm not much of a developer or a C++ guy, but I'll give refactoring this a shot; it's just going to be a bit.   

  10. 27 minutes ago, Born to machine said:

    HI 

    are m.2 drives and adm threadripper cpu's fine to run mastercam?

    Thanks

    M.2 is a form factor, so that will be fine.  If you mean NVMe, that's even better.

    Threadripper would not be my first choice.  Currently toolpath generation favors single thread performance, so I'd look at the Ryzen 7 3800, Ryzen 9 3900 or the i9-9900.

    • Thanks 1
  11. 43 minutes ago, peter ~ said:

    Thank you, It seems that you are very advanced in c#, I struggle with c# syntax , maybe If I work with your code I will understand the nuances of the language that escape me for the moment.. I write all my code in c++ and f# now if it goes into mastercam because I had to many issues mixing managed and unmanaged code, but obviously Mastercam write their code in c# no problem so I just am not doing it properly.

    I wouldn't say I'm advanced; I have so much to learn it's crippling at times. 

    I'm extremely fortunate to work with great people that are willing to share the knowledge they have amassed over the years.

    I have done several C++/C# interop hooks and I've never had an issue.  I wouldn't expect F# to make any difference; doesn't it compile to the same intermediate language as C#?

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...