Pyautocad Object/Text Layer change

Viewed 59

So I am creating text that I want to add to the document and the Layer the text appears on is the currently active layer. I want to be able to assign this text to a different layer so that I can later turn that layer on, based on specific conditions.

I found some documentation regarding changing the layer of an object and it said to use the Method.Layer and then = "Layer" (as long as that layer is defined, which it is in my code)

This is not working however, this code is just a sample from a larger file I have, here it is:

import pyautocad
from pyautocad import Autocad, APoint

acad = pyautocad.Autocad(16)
print(acad.doc.name)

LayerText = acad.doc.Layers.Item("Layer4")

T = acad.model.AddText("LARGE TEXT", APoint (0, 0), 100)
T.Layer = "LayerText"

print (T.Layer)

LayerText.LayerOn = True

it is giving me an error at T.layer = "LayerText" I am assuming the .Layer method is incorrect for what I am trying to achieve but the document I found says otherwise

Thanks!

0 Answers
Related