Message 1 of 4
Incorrect propertiesU and propertiesV from NurbsSurface.getData
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Using the code below and the attached model, the values of NurbsSurface.propertiesU and NurbsSurface.propertiesV appear correct, but the two integers corresponding with these properties returned from NurbsSurface.getData() are sometimes not. For example, a non-rational surface that is periodic along U and open along V is reported as:
NurbsSurface.propertiesU: 6
NurbsSurface.propertiesV: 1
propertiesU from getData: 4
propertiesV from getData: 4
import adsk.core, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
ent = ui.selectEntity("Select a face", "Faces")
if not (isinstance(ent.entity.geometry, adsk.core.Surface)): return
surface = ent.entity.geometry
if surface.surfaceType != adsk.core.SurfaceTypes.NurbsSurfaceType:
print("Not a NurbsSurface.")
return
ns = surface
print("NurbsSurface.propertiesU: {}".format(ns.propertiesU))
print("NurbsSurface.propertiesV: {}".format(ns.propertiesV))
rc = ns.getData()
if not rc[0]: return
(
propertiesU,
propertiesV,
) = rc[-2:]
print("propertiesU from getData: {}".format(propertiesU))
print("propertiesV from getData: {}".format(propertiesV))
#print(rc)
except:
if ui:
sError = 'Failed:\n{}'.format(traceback.format_exc())
print(sError)
ui.messageBox(sError)
Thank you