Verified Members
  • Content count

  • Joined

  • Last visited

Community Reputation

87 Excellent

1 Follower

About jeff.D

  • Rank

Recent Profile Visitors

731 profile views
  1. Yeah, that won't work. The OffsetChain2D method returns the offset chain and you're not using the returned value. Once you get the returned (offset) chain, you'll still need to use the ChainManager to get the geometry in the chain, then commit each entity in the chain. Below is a working example, hope it helps! namespace OffsetExample { using Mastercam.App; using Mastercam.App.Types; using Mastercam.Database; using Mastercam.Database.Types; public class Main : NetHook3App { public override MCamReturn Run(int param) { var selectedChain = ChainManager.GetOneChain("Select a Chain"); var offsetChain = selectedChain.OffsetChain2D(OffsetSideType.Left, .245, OffsetRollCornerType.None, .5, false, .005, false); var offsetGeometry = ChainManager.GetGeometryInChain(offsetChain); foreach (var entity in offsetGeometry) { entity.Commit(); } return MCamReturn.NoErrors; } } }
  2. Can you upload a snippet of your code? Also, what version of Mastercam are you using?
  3. Have you tried the OffsetChain2D method in the Chain class? The chain class is in the Mastercam.Database namespace.
  4. jeff.D

    Tool Description

    You've probably figured this out already, but the tool description isn't available to MP. The only way I know how to get the description into the posted code is to create a Net-Hook and call it from the post.
  5. jeff.D

    Get tplane name

    You can use a NET-Hook to do this, below is a basic example. The NET-HOOK - namespace QueryViews { using System.Linq; using Mastercam.App; using Mastercam.App.Types; using Mastercam.Posting; using Mastercam.Posting.Types; using Mastercam.Support; using Mastercam.Database; public class Main : NetHook3App { #region Public Override Methods /// <summary> The main entry point for your QueryViews. </summary> /// /// <param name="param"> System parameter. </param> /// /// <returns> A <c>MCamReturn</c> return type representing the outcome of your NetHook application. </returns> public override MCamReturn Run(int param) { var postArguments = GetPostArguments(); var view = GetView(postArguments.Argument1); if (view != null) { SetPostArguments(view.WorkOffsetNumber.ToString(), view.ViewID.ToString(), view.ViewOrigin.ToString()); return MCamReturn.NoErrors; } else { SetPostArguments($"-99999", $"{postArguments.Argument1} NOT FOUND", $"{postArguments.Argument1} NOT FOUND"); return MCamReturn.ErrorOccurred; } } private PostProcessorArgumentsType GetPostArguments() => (PostProcessorArgumentsType)PostingManager.PostProcessorArguments; private MCView GetView(string name) => SearchManager.GetViews() .Where(v => v.ViewName.ToUpper() == name.ToUpper()) .Select(v => v).FirstOrDefault(); private void SetPostArguments(string argumentOne, string argumentTwo, string argumentThree) { PostProcessorArgumentsType returnArguments; returnArguments.Argument1 = argumentOne; returnArguments.Argument2 = argumentTwo; returnArguments.Argument3 = argumentThree; PostingManager.PostProcessorArguments = returnArguments; } #endregion } } The post - #region Numeric Variable Initializations dll_return : 0 #endregion End Numeric Variable Initializations #region String Variable Initializations sdq : '"' # " sspace : " " snone : "none" sinvalid : "-99999" sdll : "QueryViews.dll" sdll_args : "" #endregion End String Variable Initializations #region Query Views sview_name : "TestWCS" fq 1 sview_name "Enter a View's Name to Query" pquery_views q1 sdll_args = sdq + sview_name + sdq dll_return = dll(sdll, sdll_args) if spost_arg_0$ <> sinvalid, [ sview_name, "- Found!", e$ " Work Offset ->", spost_arg_0$, e$ " View ID ->", spost_arg_1$, e$ " Origin ->", spost_arg_2$, e$ ] else, "ERROR -", spost_arg_1$, e$ #endregion Query Views psof$ pquery_views Output - // TestWCS - Found! // Work Offset -> 59 // View ID -> 52 // Origin -> X0.0000 Y0.0000 Z0.0000
  6. jeff.D

    Get tplane name

    The NCI will only contain the view/plane information for the posted operations. You can call a Hook from the post to interrogate the Mastercam file and get the view objects. What exactly are you trying to do?
  7. jeff.D

    Character counts

    A minimally tested post block using regular expressions below. Keep in mind that the regex function is only in Mastercam 2019 and beyond sinput : "" sregex : "^(.{0,16}).*?_(.*?)_(.*?)\." spart_number : "" srevision : "" soperation : "" pparse_string spart_number = regex(sregex, sinput, 10) srevision = regex(sregex, sinput, 20) soperation = regex(sregex, sinput, 30) "The first 16 characters of the part number is:", e$ " ", "->", spart_number, e$ *e$ "The revision is:", e$ " ", "->", srevision, e$ *e$ "The operation number is:", e$ " ", "->", soperation, e$ //Output: // The first 16 characters of the part number is: // -> 980-1000001258-5 // // The revision is: // -> A // // The operation number is: // -> OP1
  8. jeff.D

    Character counts

    That sounds like a job for regex!
  9. jeff.D

    Character counts

    I may be misunderstanding, but it appears from your example that you just want the first 16 characters of the string. If you're using Mastercam 2019 you can use a regex to only grab up to the first 16 characters in a string, below is a simple example ^.{1,16} Prior to 2019 you cancheck the length of the stringwith the strlen function. If the string is less than 16 characters do nothing, if it's greater than 16, use the brksps function to break the string 16 places in.
  10. jeff.D

    G99 rapid move intercept

    That list appears to be from the Version 9.1 post docs (Volume 3, chapter 4); that's why I wanted to bring it up, it's quite out of date.
  11. jeff.D

    G99 rapid move intercept

    Just so you are aware, that list of tool_op$s is not for the current release of Mastercam.
  12. jeff.D

    New Mikron

    The control is different, but nothing about it is hard. Have you have training yet? GF used to offer training at their facility for free; if that's still the case take advantage of it. Also, call GF! Their apps guys are second to none in my experience and really know the machine and control inside and out. Take that last part with a grain of salt... I used to be a Mikron Apps guy for GF.
  13. Hi, I know nothing about the capabilities of the VB script dll. But, if you swapped over to a NET-Hook this is easily done with the EnumerateFiles method and Linq. var mastercamExtentions = new List<string> { ".MCAM-CONTROL", ".MCAM-MMD", ".MCAM-LMD", ".MCAM-RMD", ".MCAM-WMD", ".PST", ".PSB", ".PSM", ".MCPOST", ".MCBPOST", ".MCDPOST", ".MACHINE", ".MCAM" }; var allFiles = Directory .EnumerateFiles(folderPath, "*", SearchOption.AllDirectories) .Where(file => mastercamExtensions.Any(file.ToUpper().EndsWith)) .ToList(); You can read more about this here.
  14. Did you copy and paste that code from your editor? If so you have some extra junk after the 15332, see below. Once I removed the extra characters everything worked as expected.
  15. jeff.D

    4 Axis?!?

    The post linked to Mill Default (mpfan.pst) is a 4-axis post.

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