Answer the question
In order to leave comments, you need to log in
Is it possible to change line weight in autocad via pyautocad?
In the code below, I create a square and in some sides I need to make more weight. In Google, I found the Lineweight method, which does not fit under AddLine because it interacts with other objects. Actually questions:
1. How to increase line weight?
2. Is there another python library to work with autocad?
3. Another PL for working with autocad, if any
from pyautocad import Autocad, APoint
acad = Autocad(create_if_not_exists=True)
# Фасад
x1 = int(input('Введите x1:\t'))
y1 = int(input('Введите y1:\t'))
x2 = int(input('Введите x2:\t'))
y3 = int(input('Введите y3:\t'))
# Задаем параметры точек основания здания
p1 = APoint(x1, y1)
p2 = APoint(x2, y1) # Параметр y2, x3, x4, y4 не задается, из условия что фундамент
p3 = APoint(x1, y3) # квадратной/прямоугольной. формы. Используется x1 -> x3; x2 -> x4; y3 -> y4
p4 = APoint(x2, y3) # y1 -> y2
A = acad.model.AddLine(p1, p2)
acad.model.AddLine(p1, p3)
acad.model.AddLine(p2, p4)
acad.model.AddLine(p3, p4)
Answer the question
In order to leave comments, you need to log in
1. You can increase the line weight:
#создаём линию
A = acad.model.AddLine(p1, p2)
#устанавливаем её вес, например, 1мм
A.Lineweight = 100
"""
Веса линий кодируются как:
-3 - по умолчанию
-2 - по блоку
-1 - по слою
0 - 0мм
5 - 0,05мм
...
40 -0,4мм
...
100 - 1мм
и т.д.
"""
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question