Skip to content

Instantly share code, notes, and snippets.

View apprentice3d's full-sized avatar

Denis Grigor apprentice3d

View GitHub Profile
@apprentice3d
apprentice3d / ssa_example.py
Created February 25, 2026 16:06
Authentication handler for Service-to-Service Authentication (SSA) with Autodesk Platform Services
import time
import jwt
import requests
class AuthenticationHandler:
"""
Authentication handler for Service-to-Service Authentication (SSA) with Autodesk Platform Services.
@apprentice3d
apprentice3d / oauth_browser_example.py
Last active February 25, 2026 15:57
OAuth2 Authentication Helper for M&E Data SDK
"""
OAuth2 Authentication Helper for M&E Data SDK
For production use, please implement your own authentication handler with the help of ADSK documentation.
This is just a simple quickstart solution to get authenticated.
It opens a local HTTP server to listen for the OAuth2 redirect with the authorization code,
exchanges the code for tokens, and manages token refreshing.
"""
@apprentice3d
apprentice3d / gist:d9976c3f7519d71998238d7e2fbf4ca9
Created March 29, 2024 13:40
Support files for TradeTapp API
testing
collection of images used in Drawing App tutorial
hfdm_screenshot
@apprentice3d
apprentice3d / practiceViewer.js
Created May 3, 2017 20:09
IntermediateNotestForComponentManipulation
function getFragment(NodeId) {
tree.enumNodeFragments(NodeId, function (frag) {
console.log("Object "
+ tree.getNodeName(NodeId)
+ "with parrent "
+ tree.getNodeName(tree.getNodeParentId(NodeId))
+ " has fragment "
+ frag);
});
}
@apprentice3d
apprentice3d / informix_display_impl_final.cpp
Created May 31, 2016 16:33
Final version of Informix::Display method
int Informix::Display(TimeValue t, INode* inode, ViewExp* vpt, int flagst, ModContext* mc)
{
TimeValue current_time = GetCOREInterface()->GetTime();
Box3 bounding_box;
inode->EvalWorldState(current_time).obj->GetLocalBoundBox(current_time, inode,vpt,bounding_box);
Point3 min = bounding_box.Min();
Point3 max = bounding_box.Max();
Point3 x_max(max.x, min.y, min.z);
Point3 y_max(min.x, max.y, min.z);
Point3 z_max(min.x, min.y, max.z);
@apprentice3d
apprentice3d / Informix_wings_impl.cpp
Created May 31, 2016 16:31
Creating a control method for arrow "spreading"
void Informix::makeWingsidePoints( Point3 reference_point,
Point3 &wing_side_point,
Point3 &wing_other_side_point,
float arrow_wing_factor,
const Point3 source)
{
wing_side_point = reference_point;
wing_other_side_point = wing_side_point;
if(reference_point.x != source.x)
@apprentice3d
apprentice3d / Informix_drawMyArrows_impl.cpp
Created May 31, 2016 16:29
Method encompassing all drawing steps
void Informix::drawMyArrows(Point3 p1, Point3 p2, const wchar_t* my_text, ViewExp* vpt)
{
float arrow_scale_factor = 0.05;
float arrow_wing_factor = 10.0f; // max(max(p1.z + p2.z, p1.x + p2.x)*arrow_scale_factor, 1);
pblock2->GetValue(pb_wing_spin, GetCOREInterface()->GetTime(), arrow_wing_factor, FOREVER);
Point3 wing_side_point(0,0,0);
Point3 wing_other_side_point(0,0,0);
Point3 ref_point((p1.x + p2.x), (p1.y + p2.y), (p1.z + p2.z));
Point3 midpoint = ref_point / 2;
@apprentice3d
apprentice3d / informix_display_impl.cpp
Created May 31, 2016 16:20
Implementation of the Informix::Display method
int Informix::Display(TimeValue t, INode* inode, ViewExp* vpt, int flagst, ModContext* mc)
{
GraphicsWindow *gw = vpt->getGW();
DrawLineProc lp(gw);
lp.SetLineColor(1, 0, 0);
Point3 my_gismo_points[5] = { Point3(0, 0, 0), Point3(-80, 0, 0),
Point3(-60, 10, 0), Point3(-80, 0, 0),
Point3(-60, -10, 0) };
lp.proc(my_gismo_points, 5);
gw->setColor(TEXT_COLOR, 1, 1, 1);