rmcanany / SolidEdgeHousekeeper

Utility for finding annoying little errors in your Solid Edge project
MIT License
21 stars 6 forks source link

Integrate Direct File Properties Manipulation #95

Open rmcanany opened 1 month ago

rmcanany commented 1 month ago

https://github.com/rmcanany/SolidEdgeHousekeeper/issues/92

farfilli commented 1 month ago

@rmcanany Can you explain me the usage of this part of code? I need to implement an SEDoc free for the SolidEdgeRequired = false version

'######### TBD: Create an Overloads of TC.SubstitutePropertyFormula that uses the OLEProperties object
'If Proceed Then
'    Try
'        FindString = TC.SubstitutePropertyFormula(SEDoc, FindString, ValidFilenameRequired:=False)
'    Catch ex As Exception
'        Proceed = False
'        ExitStatus = 1
'        s = String.Format("Unable to process formula in Find text '{0}' for property '{1}'", FindString, PropertyName)
'        If Not ErrorMessageList.Contains(s) Then ErrorMessageList.Add(s)
'    End Try

'    Try
'        ReplaceString = TC.SubstitutePropertyFormula(SEDoc, ReplaceString, ValidFilenameRequired:=False)
'    Catch ex As Exception
'        Proceed = False
'        ExitStatus = 1
'        s = String.Format("Unable to process formula in Replace text '{0}' for property '{1}'", ReplaceString, PropertyName)
'        If Not ErrorMessageList.Contains(s) Then ErrorMessageList.Add(s)
'    End Try
'End If
rmcanany commented 1 month ago

Yes. That replaces a property formula with its value. For example %{Custom.Engineer} -> "FRED".

farfilli commented 1 month ago

Got it, I'll complete it tomorrow

Il mar 4 giu 2024, 17:27 rmcanany @.***> ha scritto:

Yes. That replaces a property formula with its value. For example %{Custom.Engineer} -> "FRED".

— Reply to this email directly, view it on GitHub https://github.com/rmcanany/SolidEdgeHousekeeper/issues/95#issuecomment-2147821218, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVFLLNQRFKC23WTX2PF4W3ZFXMGLAVCNFSM6AAAAABIYWPSHGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBXHAZDCMRRHA . You are receiving this because you commented.Message ID: @.***>

rmcanany commented 1 month ago

I looked at the code more closely. A more accurate description is that it replaces all formulas in a string. Here's a better example: "Material: %{System.Material}, Engineer: %{Custom.Engineer}" --> "Material: STEEL, Engineer: FRED"

farfilli commented 1 month ago

Completed with #96

farfilli commented 1 month ago

System.Document Number System.Revisiom Number System.Projct Name

Those properties need to be implemented cause they are in a different stream. Will do it soon

rmcanany commented 1 month ago

OK. Sounds good. I'm going to try it out tomorrow.

While you're in there could you add some sort of error message for index-reference properties? That's what I call them, anyway -- the ones with the |R1, |R2, ... modifiers. I believe you said they can't currently be processed with the new Structured Storage technique.

rmcanany commented 1 month ago

That is blazing fast! Nice work!

farfilli commented 1 month ago

Implemented Project properties (ReadOnly at the moment) Implemented error handling for links with the syntax |R1 ecc

rmcanany commented 1 month ago

OK, cool. Should I close this issue, or leave it open for the upstream ReadOnly fix?

farfilli commented 1 month ago

Let's wait some days and see if it get quickly fixed

farfilli commented 4 weeks ago

When and if it get fixed I should be able to also update Material properties and potentially also FOA properties

farfilli commented 4 weeks ago

With pull request #105 I have completed the editing of Project Properties which works perfectly now. I did investigate the ability to change other properties that are not text, for example, the material values and the hardware checkbox, there are still some problems so we are not done yet.

I have also revamped the PropertyEdit page, choosing from System to Custom will make the PropertyName a ComboBox or a TextBox depending on which is selected.

The idea is to populate the combo with only usable properties I have inserted now Project and System as populated, perhaps is better to just list all of them in a single category System? The code will then open the proper stream to edit

Proper values are loaded at default with commit 976586d837363a00e6282652c106d5a2e0118d06 image

farfilli commented 3 weeks ago

I'm able to change properties that are number, used in material properties, Density is not there so it is not possible with this tool. Does it make sense to enable material editing?

Is Hardware property manipulation of any interest? I can add it

farfilli commented 3 weeks ago

Property edit page buttons work and also restoring properties on load. If a row is left empty subsequent rows, even if compiled, seem to be ripped off, I don't know if it was like that before. Is this an acceptable behavior?

rmcanany commented 3 weeks ago

That looks great! Especially the ComboBox feature. I might look at extending it to read a user's templates for custom properties.

Speaking of custom properties, I only added the System and Custom flags because I noticed that SE allows a user to name a custom property using a name that's already in another stream. Not sure why they allow that. I believe I read somewhere that causes problems with Callouts, etc.

I don't remember if it previously handled blank rows correctly. My code for that is convoluted. As I recall, it works by reading the form contents then populates a dictionary from that. I realized in working on the Edit Task List functionality that a better approach is to first update the dictionary, then redraw the form with updated contents. I need to do the same with Property Edit and Property Filter.

As far as material properties go, I added that because changing the property Material does not automatically update density, facestyle, etc. I think I had to use Material Table functionality to do that.

Anyway, it looks good. I might get a chance this weekend to play around with it. Thank you for all your work!

farfilli commented 3 weeks ago

The solution is to create a custom control that handle the property row, it will contains all the logic to get and set values. Main form will contain a list of them very easy to add , move and delete.

The code would became much more compact and clear.

And best of all you don't need all that dictionaries 😁

rmcanany commented 2 weeks ago

@farfilli I'm testing the new TaskControl setup and I ran across a couple of issues with Edit Properties.

First, it doesn't seem to obey the Edit outside Solid Edge flag. If that option is unchecked, it still uses the StructuredStorage method. Also, if I select another task that cannot be done without SE, it generates an error message about a conflict.

Second, I used Add folder and subfolders to select files to process. In the picture, I chose 7481-10000. Some files in that tree have links to 7481-01000. They shouldn't be processed, but Edit Properties tried anyway. It couldn't find them because they're outside the folder I specified, so generated some errors.

filelist

farfilli commented 2 weeks ago

@rmcanany I just had a quick test and the "Edit outside Solid Edge" seems to work correctly; if selected it uses the Process(FileName as string) method if not it uses the Process(SeDoc, Configuration....) method.

The conflict error message appears when tasks of different types are selected; when a file is opened in Solid Edge there is no need for the structured storage method, also it could not work due to the file lock.

Perhaps a method that automatically unchecks the direct edit in case of conflict could be implemented.

About the folder question I'm not sure of what you mean, I have implemented a direct edit process method, it just work on the file list provided as usual