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

Everything posted by Zaffin_D

  1. Yeah, normally I wouldn't post the exact solution, but there aren't many enhanced tool-table examples in the wild. Jlw hit the nail on the head, it's used for string manipulation. It's much more powerful than MP's 'legacy' string functions. That key combination is not a something that should be used in most circumstances. That keystroke combination is from V9 when there was no machine and control definition. With the MD/CD/Post setup it can be dangerous to swap a post in on the fly, especially if the post reads data from the MD/CD.
  2. Hi Skyroks, Have you contacted your Mastercam reseller about this?
  3. I updated this based on some feedback, the latest install files can be found here.
  4. Here you go. [POST_VERSION] #DO NOT MOVE OR ALTER THIS LINE# V21.00 P4 E1 W21.00 T1505932414 M21.00 I0 O10 # ToolList.mcpost #region Settings #region User Settings # Max length of stool_name, used for formatting name_length : 24 # Max length of sassembly_name, used for formatting assembly_length : 14 #endregion #region Post Settings x_tooltable$ : 1 newglobal$ : 1 rotaxtyp$ : 99999 #endregion #endregion #region initializations #region Enumerators ZERO@ : 0 ONE@ TWO@ TOOL_INFO_TABLE@ : 1 OP_PARAMETERS@ : 0 TOOL_NOT_OUTPUT@ : 1 #endregion #region Numerics result : 0 op_number : 0 #region Globals diameter = tlrad$ corner_radius = tcr$ #endregion #endregion #region Strings stool_name : "" sholder_name : "" sassembly_name : "" sspaces : " " sregex : "" #endregion #endregion #region Formats #region Statments fs2 1 0.8 0.8 fs2 2 0.4 0.3 fs2 3 1 0 1 0 #endregion #region Assignments fmt "" 3 op_number "" fmt " " 3 tt_tool$ " " fmt "" 3 name_length "" fmt "" 3 assembly_length "" fmt "" 2 diameter " " fmt "" 2 corner_radius " " #endregion #endregion #region Lookup Tables fprmtbl 1 4 # TOOL_INFO_TABLE@ 15240 op_number 20001 stool_name 20020 sholder_name 20021 sassembly_name #endregion pset_string_length sregex = ".{" + drs_str(TWO@, name_length) + "}" stool_name = stool_name + sspaces stool_name = regex(sregex, stool_name) sregex = ".{" + drs_str(TWO@, assembly_length) + "}" sassembly_name = sassembly_name + sspaces sassembly_name = regex(sregex, sassembly_name) ptooltable$ if tt_count$ = TOOL_NOT_OUTPUT@, [ result = fprm(TOOL_INFO_TABLE@, OP_PARAMETERS@) pset_string_length *tt_tool$, stool_name, *diameter, [if corner_radius > ZERO@, *corner_radius, else, " "], sassembly_name, sholder_name, e$ *e$ ] pheader$ "Tool Number Tool Name Diameter Corner Radius Assembly Holder", e$ *e$ x_tooltable$
  5. I did some thinking and an asynchronous timer is the only thing I came up with. It works, but I don't like the static half second delay. I'm hoping someone will jump in with a better solution. Public Overrides Function Run(param As Integer) As MCamReturn Dim solidsMask = New GeometryMask(False, False, False, False, False, False, True) Dim allSolidEntities = SearchManager.GetGeometry(solidsMask) For Each solidEntity As SolidGeometry In allSolidEntities solidEntity.Selected = True solidEntity.Commit() Next If allSolidEntities.Any() Then Dim timer = New Timers.Timer(500) AddHandler timer.Elapsed, AddressOf OnTimedEvent timer.AutoReset = False timer.Start() ExternalAppsManager.RunFTCommand("sld_convert_to_surfs") Else DialogManager.Error("No Solids Found", "No Solids Found") End If Return MCamReturn.NoErrors End Function Private Sub OnTimedEvent() MastercamWindow.SetFocusToMastercam() SendKeys.SendWait("{ENTER}") MastercamWindow.SendEscapeKeyPress() SendKeys.Flush() End Sub
  6. Hello eMastercam, I've been working on a pet project that I think could be beneficial to some Mastercam users. Quick Parameters is a NET-hook that consists of a single modeless window displaying a subset of the selected operation's parameters. **Please note, this only works for operations that the NET-Hook API knows about. This means that it will not work on lathe or wire operations. To install, copy the files from the QuickParameters.zip archive attached to this post to the following locations; Copy 'Xceed.Wpf.Toolkit.dll' to the Mastercam install directory, typically 'C:\Program Files\Mcam2019' Copy 'GalaSoft.MvvmLight.dll', 'QuickParameters.dll', and 'QuickParameters.ft' to Mastercam's chook directory, typically 'C:\Program Files\Mcam2019\chooks' You can grab the source on my Githib. A brief gif showing it's functionality. Right-click to customize the display colors. Feedback of any kind is always helpful. QuickParameters.zip
  7. No. I tried grabbing the handle to the Mastercam window and using SendKeys, but both PostFTCommand and RunFTCommand seem to wait till the called command is finished before moving on. I'll do a bit more digging.
  8. As do I. Anyway, how are calling the surfaces from solids command? Are you using the external apps mananger? ExternalAppsManager.PostFTCommand("sld_convert_to_surfs")
  9. I took a brief look at this. That post has all the logic to output a work offset based on the value of misc integer 1, but the value isn't output anywhere. Try forcing the string variable sgwcs where ever you want it output. Comments are not supported in this post. It would be simple to add, but I have no idea if that control supports comments.
  10. Did you ask your reseller about this? What was their response? I put a postblock on the offical Mastercam fourms that does this, I recommend you check this post.
  11. There is no escape sequence, but you can output your string in a number of ways. Create a string variable containing the double quote character and concatenate it into your string. Use single quotes to define the string, for example ' Check reference "b " '.
  12. You could use vmap to map the origin to the current toolplane.
  13. This is the post from the tech exchange correct? I'll take a look when I'm in the office tomorrow.
  14. I don't see how opinfo wouldn't work, but glad you got it working. Yes, you would need to use MP's legacy parameter read methods.
  15. No idea, but you don't really need it if you use opinfo. PREVIOUS_OP@ : -1 previous_op_id : 0 pany_postblock previous_op_id = opinfo(15237, PREVIOUS_OP@)
  16. Hi Steven, I'm not a VB guy, but try the below code. For Each wireframeEntity As Geometry In allWireframeEntities Select Case wireframeEntity.GetType() Case GetType(PointGeometry) Dim point = CType(wireframeEntity, PointGeometry) point.Color = 110 point.Commit() Case GetType(ArcGeometry) Dim arc = CType(wireframeEntity, ArcGeometry) arc.Color = 115 arc.Commit() Case GetType(LineGeometry) Dim line = CType(wireframeEntity, LineGeometry) line.Color = 125 line.Commit() Case Else End Select Next
  17. Hi Steven, Can you upload your solution here so I can take a look?
  18. Xform > dynamic would be my choice. The only issue is I can't remember if it was in X6.
  19. I don't use VB.net but here is a C# example that selects all wireframe geometry in a Mastercam file. namespace ExampleNetHook { using System.Linq; using Mastercam.App; using Mastercam.App.Types; using Mastercam.Support; using Mastercam.IO; using Mastercam.Curves; using Mastercam.BasicGeometry; using Mastercam.Database.Types; public class Main : NetHook3App { #region Public Override Methods /// <summary> /// The main entry point for your NETHook. /// </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) { // Instanciate a GeomtryMask to select only wireframe geometry var wireframeMask = new GeometryMask { Points = true, Lines = true, Arcs = true, PSplines = true, xlines = true, Surfs = false, Solids = false }; // Get all the wireframe entities in the current Mastercam file var allWireframeEntities = SearchManager.GetGeometry(wireframeMask); // Check if any wireframe entities exist in the allWireframeEntities array if (allWireframeEntities.Any()) { // Iterate through each wireframe entity foreach (var wireframeEntity in allWireframeEntities) { // Switch on each wireframe entity to determine it's type switch (wireframeEntity) { case PointGeometry point: // Do something with the point geometry break; case ArcGeometry arc: // Do something with the arc geometry break; case LineGeometry line: // Do something with the line geometry break; case NURBSCurveGeometry nurbsCurve: // Do something with the NURBS geometry break; case SplineGeometry spline: // Do something with the spline geometry break; case null: break; default: break; } } return MCamReturn.NoErrors; } else { DialogManager.Error("No wireframe found in .mcam file.", "No Wireframe Found"); return MCamReturn.ErrorOccurred; } } #endregion } }
  20. Check the current op_id$ to the previous op_id$. if op_id$ <> prv_op_id$, [ #Write opnum only if we are at a new op ]
  21. Have you looked at the toolnetapi.dll that's installed with Mastercam? That library allows you access to tool assemblys.
  22. Download the latest MPFan from Mastercam's tech exchange. In it there is a switch for this.

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...