[De...] Posted September 12 Share Posted September 12 Hi, I'm trying to create some report pages automatically, usually the way I do this is with the help of a local coordinate system. I set the localcsy as the viewing coordinate system, View Normal to a certain axis, make the elements I want to fit inside the report page exclusive, adapt zoom, make the rest of the mesh visible, snap report...etc. For one of these views, I would like to clip everything around this local coordinate frame in a say 30mm x 30mm box (x30mm*) box (clipping cube). I'm trying to use the function: gom.script.view.set_clipping_parameters which appears to take a bunch of parameters that defines a frustrum. The docstring doesn't provide much information (parameters = QVariantMap) Since I set the Local Coordinate System as the Viewing Coordinate System I can access the "Active" view attributes (i.e - gom.app.views.active_frustrum.front_plane.normal ) this seems to set the orientation correct. But for the life of me I cannot figure out the distance attributes to set the position & size. I tried feeding in the local coordinate system center then off-setting those values by the bounding box dimension -but that didnt work. tried accessing the gom.app.views.active_frustrum.front_plane.distance_to_origin, but was having trouble with that as well. Example: Code: Any help would be greatly appreciated. the zeissiqs.github.io page has been a godsent btw. -Devon Link to comment Share on other sites More sharing options...
[Ma...] Posted September 12 Share Posted September 12 Hi, I'm not really familiar with this topic, but I tried a few things and made the following observations: Even if gom.script.view.local_csys_for_viewing() is used with a local coordinate system, the frustum's normals still depend on the current view. Therefore, the normals have been created from the local CS axes (instead of using the frustum's normals). The distance is still measured from the global CS origin. The local CS was placed at the corner of the "E". The global CS is (additionally) shown at the global origin (the large one without labels). The clipping has been created with the following script: import gom import gom_math gom.script.view.use_local_csys_for_viewing (csys=gom.app.project.inspection['MyCS']) normal1 = gom.app.project.actual_elements['MyCS'].csys_geometry.direction1 normal2 = gom.app.project.actual_elements['MyCS'].csys_geometry.direction2 normal3 = gom.app.project.actual_elements['MyCS'].csys_geometry.direction3 gom.script.view.set_clipping_parameters (parameters={'clipping_enabled': True, 'plane_back_distance': 23, 'plane_back_normal': gom_math.Vec3d_mult_scalar(normal3, -1), 'plane_front_distance': 0, 'plane_front_normal': normal3, 'plane_bottom_distance': -13, 'plane_bottom_normal': gom_math.Vec3d_mult_scalar(normal2, -1), 'plane_top_distance': 30, 'plane_top_normal': normal2, 'plane_left_distance': 20, 'plane_left_normal': gom_math.Vec3d_mult_scalar(normal1, -1), 'plane_right_distance': -5, 'plane_right_normal': normal1 }) Maybe there is a step missing which applies the local CS as reference? Hope this helps anyway! Best regards, Matthias P.S.: Thanks a lot for the positive feedback regarding zeissiqs.github.io - we love to read that! Link to comment Share on other sites More sharing options...
[De...] Posted September 12 Author Share Posted September 12 (edited) Thanks Matthias for the quick response! Im still having trouble figuring this out, I think your solution for calculating the normals of the clipping cube is much more elegant, I was setting the active view through the script, --> then extracting those values from the active view. ( gom.script.view.use_local_csys_for_viewing + gom.script.view.set_zm --> get gom.app.views.active_frustum.front_plane.normal ) I think I'm having difficulty because my part is in vehicle coordinates (2000mm away from global csy) and my local frame is at some crazy compound angle relative to the global csy. I tried simplifying things, and created a local frame with the same normals as the global csy, just translated to my part. I also offset the X/Y/Z value of this local CSY by roughly 15-20mm in each direction and created 6 parallel planes. This essentially represents the clipping cube i'm after. When I tried recording this clipping cube while manually viewing from the Z- Direction, 1. it omits the front back distance.. (which I understand why, and is ok) 2. Front/Back= Z, Bottom/Top = X, Right/Left = Y. (... I think). 3. Top distance is negative, while the bottom distance is positive.(...huh? My Intuition tells me this would create a clipping cube 3000mm long. ) but I just recorded a 30mm^2 cube. regardless, I tried to match these values by using the local csy attributes & multiplying one of the values by negative 1. which worked! I then chose another local CSY, and it worked as well but when I rotated the 2nd coordinate frame, it did not. =( The Normals of the clipping cube look correct, but I feel like its doing a a rotate translate, vs translate rotate sorta thing (?) & i'm still not sure why 1 of the distance values = positive and 1 = negative.. Anyways, any sorta feedback is greatly appreciated! This forum is like a goldmine, I can spend all day reading these threads... Thank you! Edited September 12 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in