(Russian) Python в ArchiCAD 23

Ivan @ 02 / 09 / 2020 @ Медиа / Памятки / Programming / Уроки
( / / )

Время чтения: ~ 4 мин.

Sorry, this entry is only available in Russian. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language.

Все сказано в ролике, текст программы ниже rotateselectedtext.py. Про скрипты в InDesign вот тут. Ещё про питон — см. в рубрике программирование. Бесплатный курс по Питону.

import math 
from random import seed
from random import randint

print ('{:-^30}'.format ('BEGIN'))

# __APIType: Text Element
# head: (APIObject: Element Header)
# head.__APIType: Element Header
# head.typeID: 15
# head.variationID: 0
# head.guid: DD8C0DBB-C49B-48F6-B32E-6F8025693C37
# head.modiStamp: 883107
# head.groupGuid: 00000000-0000-0000-0000-000000000000
# head.hotlinkGuid: 00000000-0000-0000-0000-000000000000
# head.floorInd: 0
# head.layer: 42
# head.hasMemo: True
# head.drwIndex: 10
# head.userId: 0
# head.lockId: 0
# head.rgr_layer: 0
# head.renovationStatus: -1
# head.renovationFilterGuid: E9C06C46-F7E2-4023-8435-9242864B1041
# pen: 86
# faceBits: 1
# font: 369
# fixedAngle: False
# anchor: 0
# just: 1
# size: 3.0
# spacing: -1.0
# angle: 0.0
# charCode: 11
# effectsBits: 0
# widthFactor: 1.0
# charSpaceFactor: 1.0
# fixedSize: True
# usedContour: False
# usedFill: False
# contourPen: 65
# fillPen: -1
# loc: (APIObject: 2D Coordinate or Vector)
# loc.__APIType: 2D Coordinate or Vector
# loc.x: 0.2
# loc.y: 0.2
# width: 24.7955
# height: 4.71429
# nonBreaking: True
# multiStyle: False
# useEolPos: False
# nLine: 1
# owner: 00000000-0000-0000-0000-000000000000
# contourOffset: 0.0
# flipEnabled: True

# guid = ClickElement () 


i=0
for guid in GetSelectedElements ():
	if guid != None:
		elementTuple = GetElement (guid) #returns tuple!!!!
		i+=1
		# print (type(elementTuple))
		# print (elementTuple[0].List())
		# print ("///")
		# print (elementTuple[1].List())
		# element = APIObject ()

		#elementTuple[0].anchor = 0 #change the anchor point
		elementTuple[0].angle = math.radians(randint(0, 360))
		ChangeText (elementTuple[0])

		print ("x: "+str(elementTuple[0].loc.x)+" y: "+str(elementTuple[0].loc.y))


print (' elements rotated: '+str(i))
print ('{:-^30}'.format ('END'))

 


Similar Posts:


Subscribe!

Instagram
VK
Facebook
YouTube!
Telegram!

Subscribe to mail list



* clicking the ‘Subscribe’ button you agree that your personal data will be processed