SimplifiedLogic / creoson

OpenSource Automation using JSON Transactions for PTC's CREO Parametric
http://www.creoson.com
MIT License
79 stars 23 forks source link

Edge Detail Requests #72

Open a09418849 opened 3 years ago

a09418849 commented 3 years ago

Would it be possible to get the edge's type and sampling points? Request :

{
  "sessionId": "~sessionId~",
  "command": "geometry",
  "function": "get_edges",
  "data": {
    "file": "TEMP.prt",
    "surface_ids": [
      12
    ],
   "Precision": 2
  }
}

Response :

........
{
    "edge_id": 35,
    "edge_type":"LINE",
    "length": 10,
    "start": {
      "x": 0,
      "y": 0,
      "z": 0
    },
    "end": {
      "x": 0,
      "y": 0,
      "z": 10
    },
   "sample":[ [0,0,0], [0,0,2], [0,0,4], [0,0,6], [0,0,8], [0,0,10] ]
}
.......

Precision could be related in 0~1 or absoluted like above.

edge_type : LINE ARC SPLINE.....

I think if possible, adding surface type would be perfect.

surface_type: PLANE CYLINDER SPHERE....

I need this because I want to get the model section and convert the section to GeoJSON.

adama2000 commented 3 years ago

Hm, well we can get the surface objects that bound the edge, and from there we could probably get the surface type?

As for the sampling points we may not be able to. There is a function called "EvalUV(double)" which "Evaluates the edge at a particular t-parameter location in terms of the UV coordinates of the edge." according to PTC. This returns a structure containing the two UV points, and two derivatives for the two points (as 2D vectors). Not sure whether that helps.

On Sat, Aug 7, 2021 at 3:55 PM a09418849 @.***> wrote:

Is it possible to get the edge's type and sampling points? Request :

{

"sessionId": "~sessionId~",

"command": "geometry",

"function": "get_edges",

"data": {

"file": "TEMP.prt",

"surface_ids": [

  12

],

"Precision": 2

}

}

Response :

........

{

"edge_id": 35,

"edge_type":"LINE",

"length": 10,

"start": {

  "x": 0,

  "y": 0,

  "z": 0

},

"end": {

  "x": 0,

  "y": 0,

  "z": 10

},

"sample":[ [0,0,0], [0,0,2], [0,0,4], [0,0,6], [0,0,8], [0,0,10] ]

}

.......

Precision could be related in 0~1 or absoluted like above.

edge_type : LINE ARC SPLINE.....

I think if possible, adding surface type would be perfect.

surface_type: PLANE CYLINDER SPHERE....

I need this because I want to get the model section and convert the section to GeoJSON.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SimplifiedLogic/creoson/issues/72, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANPKPH7FGRKLFFI4NIGNJDT3WFSLANCNFSM5BXWW73A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

a09418849 commented 3 years ago

In toolkit for C language, I used ProEdgeXyzdataEval to get XYZ coord

ProEdgeXyzdataEval(myEdge, edge_param, VtxXYZ, VtxDerv1, VtxDerv2, VtxDir)

The VtxXYZ is what I need. Edge_param is between 0~1. edge_param = 0 --> start point edge_param = 1 --> end point

In PTC User's Guide

#include <ProEdge.h>
ProError    ProEdgeXyzdataEval  (
    ProEdge edge    
    /* (In)
    The edge handle
    */
    double edge_param   
    /* (In)
    The normalized parameter on the edge
    */
    ProVector xyz_point 
    /* (Out)
    The resulting XYZ point
    */
    ProVector deriv1    
    /* (Out)
    The first derivative
    */
    ProVector deriv2    
    /* (Out)
    The second derivative
    */
    ProVector direction 
    /* (Out)
    The edge direction
    */
)

I don't know is there any function like ProEdgeXyzdataEval in Jlink.

About surface type, actually I don't know how to get it by toolkit. But I think it is possible by importing surface id.

..........
"data": {
    "surface_type":"CYLINDER",
    "contourlist": []
    }
..........
adama2000 commented 3 years ago

That sounds the same as the EvalUV JLink function I was talking about.

a09418849 commented 2 years ago

That sounds the same as the EvalUV JLink function I was talking about.

I found that the code edge.Eval3DData(parameter) can get what I need. edge.Eval3DData(0.0) = start point edge.Eval3DData(1.0) = end point If I could control parameter in edge.Eval3DData(parameter) , I can get any point on the edge. Could you offer the function to import parameter? Like this:

{
  "sessionId": "~sessionId~",
  "command": "geometry",
  "function": "get_edges",
  "data": {
    "file": "box.prt",
    "surface_ids": [
      35
    ],
   "parameter":[ 0, 0.3, 0.5, 0.7, 1.0 ]
  }
}

Response :

........
{
    "edge_id": 35,
    "edge_type":"LINE",
    "length": 10,
   "sample":[ [0,0,0], [0,0,3], [0,0,5], [0,0,7], [0,0,10] ]
}
.......
a09418849 commented 2 years ago

I think using the distance of Interval sample points would be better. Request :

{
  "sessionId": "~sessionId~",
  "command": "geometry",
  "function": "get_edges",
  "data": {
    "file": "box.prt",
    "surface_ids": [
      35
    ],
   "Interval distance": 3
  }
}

Response :

........
{
    "edge_id": 35,
    "edge_type":"LINE",
    "length": 10,
   "sample":[ [0,0,0], [0,0,3], [0,0,6], [0,0,9], [0,0,10] ]
}
.......

It must need to include start and end point.