Reply

Set "Show empty callouts and text boxes" setting

Hey guys,

 

I want to change this setting programmatically by using the solid edge api but i can't find the property for it in the draft document object.

Anybody knows where to find this setting?

The checkbox for it can be found under options->general when a draft is open.

 

Kind regards,

loginator

11 REPLIES

Re: Set "Show empty callouts and text boxes" setting

If that option can be set programmatically, I would try looking in the DraftFilePreferences object instead of the DraftDocument object. (But I haven't seen a relatively obvious solution yet.)

Siemens PLM Software, Inc.
Project Test Engineer (Automation)

Re: Set "Show empty callouts and text boxes" setting

I already looked in the DraftFilePreferences but wasn't able to see any change there. Smiley Sad

options-compare.png

On the left side is the draft with the option enabled and on the right with it disabled (I used Spy for Solid Edge).

Seems that all settings are the same.

Re: Set "Show empty callouts and text boxes" setting

Bump*

Re: Set "Show empty callouts and text boxes" setting

You need use Application.SetGlobalParameters() method, but you need find the specific constants that do you want (in this case, "Show empty callouts and text boxes").

 

 

 

GlobalParameters.PNG

 

 

 

https://docs.plm.automation.siemens.com/docs/se/108/api/SolidEdgeFramework~Application~SetGlobalPara...



==========================
Kabir Costa
Industrial Designer
kabircosta@gmail.com

Re: Set "Show empty callouts and text boxes" setting

Hey KabirCosta,
Thanks for your reply.
I also checked all Global Constants by comparing them programatically.
The only thing that changed by using the enum values is the seApplicationGlobalSystemInfo and this one only changes because it has a timestamp and some system information like memory usage Smiley Happy
Maybe its not possible to change this setting using a program? Smiley Sad
Kind regards,

loginator

Re: Set "Show empty callouts and text boxes" setting

The only alternative I see is not the best one, but it can help solve your problem:

 

You can will do:

  1. Go through sheet by sheet, create a new layer "LayerToHide" in all sheets
  2. Go through text by text, if the text is empty, add in the new layer "LayerToHide"
  3. Finnaly, hide the "LayerToHide"

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SolidEdgeFramework;
using SolidEdgeCommunity;
using SolidEdgeDraft;
using SolidEdgeFrameworkSupport;


namespace DuvidaEmptyText
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            // Main variables
            Application application = null;
            Documents documents = null;
            DraftDocument draftDocument = null;

            Sheets sheets = null;
            Sheet sheet = null;
            TextBoxes textBoxes = null;
            TextBox textBox = null;
            Layers layers = null;
            Layer layer = null;

            string emptyText = null;

            try
            {
                OleMessageFilter.Register();

                // Solid Edge Connect
                application = SolidEdgeUtils.Connect(true, true);

                // Get Active document
                draftDocument = (DraftDocument)application.ActiveDocument;

                // Get sheets
                sheets = draftDocument.Sheets;

                // Find textbox sheet by sheet
                for (int iSheet = 1; iSheet <= sheets.Count; iSheet++)
                {
                    sheet = sheets.Item(iSheet);

                    // Get Layer and create a new layer, to hide text
                    layers = sheet.Layers;
                    layer = layers.Add("LayerToHide");

                    // Verify if the sheet contains textBoxes
                    textBoxes = (TextBoxes)sheet.TextBoxes;
                    if (textBoxes.Count > 0)
                    {
                        // Find if textBox contains text, if not, hide this
                        for (int iTextBox = 1; iTextBox <= textBoxes.Count; iTextBox++)
                        {
                            textBox = textBoxes.Item(iTextBox);
                            if (textBox.Text == emptyText)
                            {
                                textBox.Layer = "LayerToHide";
                            }
                        }
                    }

                    // Finally, hide the empty texts
                    layer.Show = false;
                }



            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                OleMessageFilter.Unregister();
            }
        }
    }
}

 

The final result is:

LayerToHide.PNG

 

It isn't the best way, but works.

 



==========================
Kabir Costa
Industrial Designer
kabircosta@gmail.com

Re: Set "Show empty callouts and text boxes" setting

FYI, this setting is a file specific setting and is not a user or site setting.  In other words, you will not find this setting saved to the user registry anywhere.

 

If you want this to always be Off for all files then you would need to modify your template file and set it to Off in the template.  Then all new files created from the template would have it set to Off.

Re: Set "Show empty callouts and text boxes" setting

Hey KabirCosta,

 

maybe that's an option Smiley Happy

Do you know if there's an event that fires when text of a textbox is changed?

 

Re: Set "Show empty callouts and text boxes" setting

Hey dave,

thanks for your help.

I already changed the setting in the template.

But I also want to change it in old documents.

Kind regards loginator