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:

Active Reports Conditional Tool Data Output


EMPIND
 Share

Recommended Posts

Task:  When generating the Tools in my Active Report, I do not always want the Length of Cut, Length of Tool, etc..., printed with the tool.

Example:  Face Mill does not need Length of Cut printed in its respective row; however, an End Mill would need that information printed.

 

I am sure this needs VB or C# coding to accomplish this conditional issue.

 

If anyone can direct me to a thread which addresses this issue, or if someone has an example on how to accomplish this with a sample, it would be appreciated.

 

Thank you!

 

Link to comment
Share on other sites

Thank you Ron; however, I am not able to purchase help due to budget constraints.  I have my Active Report setup sheet close to the way I like it, but I just need to add some changes to clean it up.  Thank you.

 

I see some replys from Mick from CNC Software.  Mick, are you able to help me with this issue?  If you can give me some guidance on Conditional coding in the sub-report once Active Reports looks at each tool to alter the printing to the report?

Link to comment
Share on other sites

Thank you Ron; however, I am not able to purchase help due to budget constraints.  I have my Active Report setup sheet close to the way I like it, but I just need to add some changes to clean it up.  Thank you.

 

I see some replys from Mick from CNC Software.  Mick, are you able to help me with this issue?  If you can give me some guidance on Conditional coding in the sub-report once Active Reports looks at each tool to alter the printing to the report?

 

Best of luck and glad you are determined to figure it out. Shoot me and email and I will give you Mick's email or you can PM on the board and he should get back to you.

  • Like 1
Link to comment
Share on other sites
  • 3 weeks later...

A quick and easy way is to filter out what objects (textbox, labels) to display based upon the string name contained in the tool description field. While this might not be the most robust method it is certainly viable.

 

 

From within the subreport add the detail format event from the object drop down and then add a little C# code. 

 

Simple test for the word "FACE MILL" (case sensitive)  returns true or false, based upon the result hide or show the controls.

 

faceMill_zps96pwbtow.png

 

 

 

The result:

 

faceMill_report_zpscftf6jyl.png

 

 

 

 

 

Link to comment
Share on other sites
  • 1 month later...

Mr. George,

 

Thank you for helping me with the Conditional coding you provided to me.  It is working very well.  I have tried to add another condition to the code, but I have not been successful with my attempt at an 'if or' statement in C#.  I tried to use the || 'or' statement, but it didn't work.

We use a FACE MILL which is called SHEAR HOG.  I can use the code which you provided above, and name the tool 'FACE MILL  SHEAR HOG' and it works; however, I need it to work with the just the name 'SHEAR HOG' as the tool name.

I would appreciate if you could help me with this issue.

Thank you.

 

Link to comment
Share on other sites

Mr. George,

I need to clarify my post.  I need the code to function if the tool is named 'FACE MILL' or  'SHEAR HOG'.  My apologizes.

Thank you.

10 minutes ago, EMPIND said:

Mr. George,

 

Thank you for helping me with the Conditional coding you provided to me.  It is working very well.  I have tried to add another condition to the code, but I have not been successful with my attempt at an 'if or' statement in C#.  I tried to use the || 'or' statement, but it didn't work.

We use a FACE MILL which is called SHEAR HOG.  I can use the code which you provided above, and name the tool 'FACE MILL  SHEAR HOG' and it works; however, I need it to work with the just the name 'SHEAR HOG' as the tool name.

I would appreciate if you could help me with this issue.

Thank you.

 

 

Link to comment
Share on other sites

I am not a c# guy, it was just a guess.  I was just guessing that the .Contains object was returning a Boolean value.  By no means was I suggesting something based on direct knowledge.  That being said, hopefully Mick or someone else can chime in and educate us a little bit.  Would be nice to add to the memory bank for down the road.

Link to comment
Share on other sites
  • 6 months later...
On ‎3‎/‎17‎/‎2017 at 0:10 PM, Mick George said:

var faceMill = description.Contains("FACE MILL") || description.Contains("SHEAR HOG");

The above should work, if description contains "FACE MILL" or "SHEAR HOG" returns true else returns false, this is case sensitive.

I have a very similar question.

If BALL END MILL then don't show CORNER RADIUS value, how can I do that?  Please help.  Thank you.

 

Link to comment
Share on other sites

PcRobotic,

I whipped up a quick test as shown below.

The images show what I updated in the sub report (always give your controls proper names), added some simple C# code to filter on corner radius and the last image shows the result. You should be able to take this and edit your report to fit your needs.

 

 

result.png

code.png

report.png

Edited by Mick George
  • Like 1
Link to comment
Share on other sites
14 hours ago, Mick George said:

PcRobotic,

I whipped up a quick test as shown below.

The images show what I updated in the sub report (always give your controls proper names), added some simple C# code to filter on corner radius and the last image shows the result. You should be able to take this and edit your report to fit your needs.

 

 

result.png

code.png

report.png

 

Thank you for your "BIG HELP", I will try it.  This is what I really need help.  Once again, thank you.

ps: if VIRTUAL BASIC language then how would I define it?  Thank you.

 

Link to comment
Share on other sites
  • 2 weeks later...
On 9/27/2017 at 9:16 AM, PcRobotic said:

 

Thank you for your "BIG HELP", I will try it.  This is what I really need help.  Once again, thank you.

ps: if VIRTUAL BASIC language then how would I define it?  Thank you.

 

 

You can switch the report to VB.NET and use VB code in place of C# code as shown in the attached image.

 

 

vb.png

Link to comment
Share on other sites

Thank you for your help,  I would like to make it shows like this:

If BULL END MILL then show radius or ANY TOOLS have radius then show but not SPHERE.

 

If think you are using C# language where as I'm using VB.NET, they are different language I think.. Here is my sample of VB.NET language.

 

 If (IsNumeric(txtSHOULDER_LENGTH1.Text) And IsNumeric(FuteLength.Text)) Then
 
  If (CDbl(txtSHOULDER_LENGTH1.Text) > CDbl(FuteLength.Text)) Then
   FuteLength.Forecolor = Color.Blue
   txtSHOULDER_LENGTH1.Forecolor = Color.Blue
   
   RL.Forecolor = Color.Blue
   
   LOC.Forecolor = Color.Blue
  
  Else
  
   FuteLength.Forecolor = Color.Black
   txtSHOULDER_LENGTH1.Forecolor = Color.LightGray
   
   RL.Forecolor = Color.LightGray
   
   LOC.Forecolor = Color.Black
   
  End If
 
 End If
Link to comment
Share on other sites
21 hours ago, PcRobotic said:

Thank you for your help,  I would like to make it shows like this:

If BULL END MILL then show radius or ANY TOOLS have radius then show but not SPHERE.

 

If think you are using C# language where as I'm using VB.NET, they are different language I think.. Here is my sample of VB.NET language.

 

 If (IsNumeric(txtSHOULDER_LENGTH1.Text) And IsNumeric(FuteLength.Text)) Then
 
  If (CDbl(txtSHOULDER_LENGTH1.Text) > CDbl(FuteLength.Text)) Then
   FuteLength.Forecolor = Color.Blue
   txtSHOULDER_LENGTH1.Forecolor = Color.Blue
   
   RL.Forecolor = Color.Blue
   
   LOC.Forecolor = Color.Blue
  
  Else
  
   FuteLength.Forecolor = Color.Black
   txtSHOULDER_LENGTH1.Forecolor = Color.LightGray
   
   RL.Forecolor = Color.LightGray
   
   LOC.Forecolor = Color.Black
   
  End If
 
 End If

 

Could you attached your reports here and I'll take a look.

Link to comment
Share on other sites

If I understand your code I think this might be what you are after.

' Get the corner radius value coming in
Dim cornerRadius = Me.txtCORNER_RADIUS1.Value.ToString()

' Initialize variable that will hold the actual double value
Dim radius As Double

' Sanity checks
If String.IsNullOrEmpty(cornerRadius) Then
	
	txtCORNER_RADIUS1.Forecolor = Color.LightGray
	txtCORNER_RADIUS1.Text = "0"
	CR.Forecolor = Color.LightGray
	
ElseIf Double.TryParse(cornerRadius, radius) Then
	
	txtCORNER_RADIUS1.Forecolor = Color.Blue
	CR.Forecolor = Color.Blue
	
End If

 

Link to comment
Share on other sites
On ‎10‎/‎13‎/‎2017 at 6:35 AM, Mick George said:

If I understand your code I think this might be what you are after.


' Get the corner radius value coming in
Dim cornerRadius = Me.txtCORNER_RADIUS1.Value.ToString()

' Initialize variable that will hold the actual double value
Dim radius As Double

' Sanity checks
If String.IsNullOrEmpty(cornerRadius) Then
	
	txtCORNER_RADIUS1.Forecolor = Color.LightGray
	txtCORNER_RADIUS1.Text = "0"
	CR.Forecolor = Color.LightGray
	
ElseIf Double.TryParse(cornerRadius, radius) Then
	
	txtCORNER_RADIUS1.Forecolor = Color.Blue
	CR.Forecolor = Color.Blue
	
End If

 

 

Is there away that I can use "TOOLTYPE" as my condition?

 

Like, "IF TOOLTYPE IS SPHERE then don't show RADIUS, IF TOOL TYPE IS BULL show RADIUS".

 

Is that possible that way?  Thank you.

Link to comment
Share on other sites
9 hours ago, Mick George said:

You could use the corner radius type tag and check that in your code, if it is NONE then don't show the radius.

 

 

corner.png

Hi Mick,
   Where do I put these codes?  In side the "SCRIPT" of ACTIVE REPORT?  or... another place? 

 

 

Thank you.

Link to comment
Share on other sites

For those interested I modified PcRobitic's sub report to turn on the corner radius field based upon the corner radius type. If there is no corner radius the type the data in the xml will contain  "None" (This might need to be localized if using a non English language but I am not entirely sure) and nothing more occurs because the corner radius field is hidden by default otherwise show the corner radius field and the value mapped to it will display.

 

pc1.png

pc2.png

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

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