Skip to main content

python sdk for thinkdesign

Project description

PyThinkDesign

python sdk for thinkdesign

install

pip install PyThinkDesign

usage

1. Get active TD application

if the TD application is not running, it will be created.

from PyThinkDesign import Application
app = Application.GetActiveApplication()

2. Create a TD application

from PyThinkDesign import Application
app = Application.Application();

# Set up interactive and visibility mode if necessary.
app.PutVisible(True);
app.PutInteractive(True);
app.Quit();

3. Create lines and arcs in a document

from PyThinkDesign import Application
from PyThinkDesign import Geo3d

app = Application.Application();
doc=app.GetActiveDocument();

# get creators
curveCreator=doc.GetCurveCreator();

# add lines
p1 = Geo3d.Point(0,0,0)
p2 = Geo3d.Point(1,0,0)
p3 = Geo3d.Point(1,1,0)
p4 = Geo3d.Point(0,1,0)
curveCreator.AddLine(p1,p2)
curveCreator.AddLine(p2,p3)
curveCreator.AddLine(p3,p4)
curveCreator.AddLine(p4,p1)

# add arc
pCenter = Geo3d.Point(10,0,0)
pXDir = Geo3d.Vector(1,0,0)
pYDir = Geo3d.Vector(0,1,0) 
radius = 10
startAng = 0
endAng = 60
curveCreator.AddArc(pCenter, pXDir, pYDir, radius, startAng, endAng)

# save if necessary.
#doc.SaveAs("d:\\tdApp.e3")
app.Quit();

4. List entities information in a document

from PyThinkDesign import Application
from PyThinkDesign import Geo3d

app = Application.Application();
doc=app.GetActiveDocument();

# get creators
curveCreator=doc.GetCurveCreator();

# add lines
p1 = Geo3d.Point(0,0,0)
p2 = Geo3d.Point(1,0,0)
p3 = Geo3d.Point(1,1,0)
curveCreator.AddLine(p1,p2)
curveCreator.AddLine(p2,p3)

# add arc
pCenter = Geo3d.Point(10,0,0)
pXDir = Geo3d.Vector(1,0,0)
pYDir = Geo3d.Vector(0,1,0) 
radius = 10
startAng = 0
endAng = 60
curveCreator.AddArc(pCenter, pXDir, pYDir, radius, startAng, endAng)

# get entities information
jsonStr=doc.ListInfo()
print(jsonStr)
app.Quit();

5. how to use AddProfile?

from PyThinkDesign import Application
from PyThinkDesign import Geo3d
import time
app = Application.GetActiveApplication()
doc=app.GetActiveDocument()

# get creators
curveCreator=doc.GetCurveCreator()
profileCreator = doc.GetProfileCreator()
solidCreator = doc.GetSolidCreator()
    
# add lines
p1 = Geo3d.Point(10,0,0)
p2 = Geo3d.Point(50,0,0)
p3 = Geo3d.Point(50,30,0)
p4 = Geo3d.Point(30,30,0)
line1 = curveCreator.AddLine(p1,p2)
line2 = curveCreator.AddLine(p2,p3)
line3 = curveCreator.AddLine(p3,p4)
line4 = curveCreator.AddLine(p4,p1)

lines = [line1.ToSmartId(),line2.ToSmartId(),line3.ToSmartId(),line4.ToSmartId()]
spProfile =profileCreator.AddProfile(lines, False)

# sweep
angle = Geo3d.Angle(5)
swlen = Geo3d.Length(100)
thick = Geo3d.Length(10)
vt = Geo3d.Vector(0, 0, 1)
profSId = spProfile.ToSmartId()
spSweep = solidCreator.AddLinSweep(profSId, angle, swlen,False,False,False, thick, vt)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pythinkdesign-0.1.13.tar.gz (210.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pythinkdesign-0.1.13-py3-none-any.whl (212.0 kB view details)

Uploaded Python 3

File details

Details for the file pythinkdesign-0.1.13.tar.gz.

File metadata

  • Download URL: pythinkdesign-0.1.13.tar.gz
  • Upload date:
  • Size: 210.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pythinkdesign-0.1.13.tar.gz
Algorithm Hash digest
SHA256 13e799df4e373c99f58dff147f65fc3bcee7ae6af665e5db031c12f18ee3001c
MD5 a117220882b081dc3426cc624a9d9829
BLAKE2b-256 299950c6be70155e2ef4e8486c1b87e0eca1629fe8aca7e6bb2db4e850c0ef98

See more details on using hashes here.

File details

Details for the file pythinkdesign-0.1.13-py3-none-any.whl.

File metadata

  • Download URL: pythinkdesign-0.1.13-py3-none-any.whl
  • Upload date:
  • Size: 212.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pythinkdesign-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 e0c091aac6df4fe43b9efbe192996ad27a83c5d99152b1a61f4ac4290aaf8d0d
MD5 2a564d9dfd39ad24f20a1fa528286e9a
BLAKE2b-256 238a16651369ceec2b9ff272847182c192d927b7e7ba990a9e8c864d83e2915e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page