alt-lu / pywellcad

a Python interface to ALT's WellCAD software
BSD 3-Clause "New" or "Revised" License
12 stars 9 forks source link

Scripting functionality for the "Document Layout" section (Ctrl + 7) #156

Open r-elstermann opened 1 month ago

r-elstermann commented 1 month ago

These buttons are extremely useful in moving the logs around to relevant positions given all the logs are present in the WellCAD file already (image attached). image

As we have a standardised format for the position of all our logs, we want to ensure all WellCAD files coming through are correctly set-up. One way to ensure this is if these buttons were accessible using pywellcad so we could create an automated check rather than manually moving them if we need to.

m-schubert commented 3 weeks ago

Sorry this has taken a while to respond to, I've been on vacation.

I'll chat to the WellCAD team here and see if we can expose some of that functionality via the COM interface and then we'll look at getting it into pywellcad.

In the meantime, are you aware of the left_position, right_position and set_position() properties and methods of a log? They can be used to check the position of and move the logs programmatically inside the borehole document.

I'll need some feedback from the WellCAD team on how to achieve vertical positioning, but I'll try and get some information from them this week.

r-elstermann commented 3 weeks ago

Thanks for the response!

The position functionalities is almost an adequate solution. You mention they can be used to "check the position of", but I am unaware of how to obtain such values through these functions. If you are able to obtain these left & right position of a specific log, that would help with the horizontal aspect.

Through some testing, I couldn't find a way to get around the vertical positioning (using order of horizontal positioning) so would definitely be a great implementation.

m-schubert commented 3 weeks ago

The position functionalities is almost an adequate solution. You mention they can be used to "check the position of", but I am unaware of how to obtain such values through these functions.

Note, only set_position() is actually a method. The others are properties/attributes, and can be both get and set:

log = borehole.get_log("GR")
print(f"Left log position is {log.left_position}.")
log.left_position = 0.1
print(f"Now left log position is {log.left_position}.")

Through some testing, I couldn't find a way to get around the vertical positioning (using order of horizontal positioning) so would definitely be a great implementation.

I've confirmed with the devs here that there isn't any way to manage vertical positioning via the COM interface, so I'll open an internal ticket and see if we can get it implemented.

m-schubert commented 3 weeks ago

@r-elstermann, one other thing - have you considered simply applying templates to the borehole document to achieve a standard layout? If you have a set of templates that you normally use, you can programmatically apply them using Borehole.apply_template().

r-elstermann commented 3 weeks ago

Thanks, @m-schubert! Unfortunately, since we are the end recipients of the data, the borehole document should already be in the correct format we request, with all the data pre-loaded. However, there are times when an older template is used, which is where my QC checks come in. I believe relying on QC checks is more efficient than using a template, but I appreciate your help and suggestion!

The horizontal checks have proven to be effective and ensure that the logs are aligned in the right columns. Once the vertical functionality is implemented, it will help ensure that the logs are positioned correctly as well.