Jump to content
avictorgm

Rename objects

Recommended Posts

Hello,

 

No way to rename objects (rectangle or polygons) with:

Even with 3D polygons the problem is the same.

 

But If the element is a sphere it works. Why?

 

vs.SetName()

import vs


ObjectName = vs.GetName(vs.FSActLayer())
vs.AlrtDialog(str(ObjectName))

SName = 'Fred'
points = [0,0,-0.5,1,0.5,1.5,2,1,1,-0.5,0,0]
h1 = vs.Poly(*points)
vs.SetName(h1, SName)
import vs

X1 = 100
Y1 = 150
X2 = 0
Y2 = 500
NombreStand = 'Nombre'


SName = vs.Concat(NombreStand)
h = vs.Poly(0,0,X1,Y1,X2,Y2,0,0)

h1 = vs.SetPolyClosed(h, 1)

h2 = vs.MakePolygon(h1)

vs.DSelectAll()

vs.SetName(h2, SName)

 

This one works perfect!

import vs


ObjectName = vs.GetName(vs.FSActLayer())
vs.AlrtDialog(str(ObjectName))

SName = 'Fred'
h1 = vs.CreateSphere(0, 0, 0, 1000)
vs.SetName(h1, SName)

 

I am wondering if the problem is that are 2D elements, (that has no sense at all)

Share this post


Link to post
def vs.Poly(p):
    return None

 

Poly is not returning tha handle 😉

Look for the function LastCreatedObj or similiar to get the handle.

 

Edit:

To slow.

But one addition if you want to make sure that LNewObj is giving you the right obj you can first execute LNewObj save the handle then create the poly, do LNewObj again and check if the result is not the same as from the first call.

Edited by PatW

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×