{ "Uuid": "7aecbedf-b88d-4c57-9fad-636ca5197ec6", "IsCustomNode": false, "Description": "", "Name": "UplightText_Select", "ElementResolver": { "ResolutionMap": {} }, "Inputs": [], "Outputs": [], "Nodes": [ { "ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels", "NodeType": "PythonScriptNode", "Code": "# Load the Python Standard and DesignScript Libraries\r\nimport sys\r\nimport clr\r\n\r\nimport math\r\n\r\n# Add Assemblies for AutoCAD and Civil3D\r\nclr.AddReference('AcMgd')\r\nclr.AddReference('AcCoreMgd')\r\nclr.AddReference('AcDbMgd')\r\nclr.AddReference('AecBaseMgd')\r\nclr.AddReference('AecPropDataMgd')\r\nclr.AddReference('AeccDbMgd')\r\n\r\n# Import references from AutoCAD\r\nfrom Autodesk.AutoCAD.Runtime import *\r\nfrom Autodesk.AutoCAD.ApplicationServices import *\r\nfrom Autodesk.AutoCAD.EditorInput import *\r\nfrom Autodesk.AutoCAD.DatabaseServices import *\r\nfrom Autodesk.AutoCAD.Geometry import *\r\n\r\n# Import references from Civil3D\r\nfrom Autodesk.Civil.ApplicationServices import *\r\nfrom Autodesk.Civil.DatabaseServices import *\r\n\r\n\r\ndef main(ID):\r\n text = t.GetObject(ID, OpenMode.ForRead)\r\n cth = math.cos(text.Rotation)\r\n sth = math.sin(text.Rotation)\r\n u = Vector3d(cth, sth, 0)\r\n w = Vector3d(sth, -cth, 0)\r\n\r\n block_table = t.GetObject(db.BlockTableId, OpenMode.ForRead)\r\n ID_model_space = block_table.get_Item(BlockTableRecord.ModelSpace)\r\n model_space = t.GetObject(ID_model_space, OpenMode.ForWrite)\r\n \r\n matrix = Matrix3d.AlignCoordinateSystem \\\r\n (Point3d.Origin, Vector3d.XAxis, Vector3d.YAxis, Vector3d.ZAxis, \\\r\n text.Position, u, Vector3d.ZAxis, w)\r\n u_text = text.Clone()\r\n u_text.Position = Point3d.Origin\r\n u_text.Rotation = 0\r\n u_text.TransformBy(matrix)\r\n model_space.AppendEntity(u_text)\r\n t.AddNewlyCreatedDBObject(u_text, True)\r\n if delete_orig:\r\n text.UpgradeOpen()\r\n text.Erase()\r\n\r\n\r\ndelete_orig = IN[0]\r\n\r\nadoc = Application.DocumentManager.MdiActiveDocument\r\neditor = adoc.Editor\r\n\r\ncdoc = CivilApplication.ActiveDocument\r\n\r\nwith adoc.LockDocument():\r\n with adoc.Database as db:\r\n prompt_entity_options = PromptEntityOptions('\\n文字を選択')\r\n prompt_entity_options.SetRejectMessage('選択されたエンティティは文字ではありません')\r\n prompt_entity_options.AddAllowedClass(DBText, True)\r\n while True:\r\n er = editor.GetEntity(prompt_entity_options)\r\n if er.Status != PromptStatus.OK:\r\n break\r\n with db.TransactionManager.StartTransaction() as t:\r\n main(er.ObjectId)\r\n t.Commit()\r\n\r\n# Assign your output to the OUT variable.\r\nOUT = 0\r\n", "Engine": "CPython3", "EngineName": "CPython3", "VariableInputPorts": true, "Id": "a903bcc2594a480ebdaff711a6886209", "Inputs": [ { "Id": "15cb530073d24653b4ccd32dc5af57e2", "Name": "IN[0]", "Description": "Input #0", "UsingDefaultValue": false, "Level": 2, "UseLevels": false, "KeepListStructure": false } ], "Outputs": [ { "Id": "c61bce9e50ac473699784e1296bfad63", "Name": "OUT", "Description": "Python スクリプトの結果", "UsingDefaultValue": false, "Level": 2, "UseLevels": false, "KeepListStructure": false } ], "Replication": "Disabled", "Description": "埋め込み Python スクリプトを実行します。" }, { "ConcreteType": "CoreNodeModels.Input.BoolSelector, CoreNodeModels", "NodeType": "BooleanInputNode", "InputValue": false, "Id": "4db1d40c227d47608fe76ec913d3ac31", "Inputs": [], "Outputs": [ { "Id": "90836d36d89b42289bcf96dbd68b76a8", "Name": "", "Description": "Boolean", "UsingDefaultValue": false, "Level": 2, "UseLevels": false, "KeepListStructure": false } ], "Replication": "Disabled", "Description": "True と False のいずれかを選択します。" } ], "Connectors": [ { "Start": "90836d36d89b42289bcf96dbd68b76a8", "End": "15cb530073d24653b4ccd32dc5af57e2", "Id": "939d55b104664ff68b5541366f1ac0e2", "IsHidden": "False" } ], "Dependencies": [], "NodeLibraryDependencies": [], "Thumbnail": "", "GraphDocumentationURL": null, "ExtensionWorkspaceData": [ { "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", "Name": "Properties", "Version": "2.12", "Data": {} } ], "Author": "", "Linting": { "activeLinter": "なし", "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", "warningCount": 0, "errorCount": 0 }, "Bindings": [], "View": { "Dynamo": { "ScaleFactor": 1.0, "HasRunWithoutCrash": true, "IsVisibleInDynamoLibrary": true, "Version": "2.15.1.6076", "RunType": "Manual", "RunPeriod": "1000" }, "Camera": { "Name": "背景プレビュー", "EyeX": -17.0, "EyeY": 24.0, "EyeZ": 50.0, "LookX": 12.0, "LookY": -13.0, "LookZ": -58.0, "UpX": 0.0, "UpY": 1.0, "UpZ": 0.0 }, "ConnectorPins": [], "NodeViews": [ { "Name": "Python Script", "ShowGeometry": true, "Id": "a903bcc2594a480ebdaff711a6886209", "IsSetAsInput": false, "IsSetAsOutput": false, "Excluded": false, "X": 594.0, "Y": 261.5 }, { "Name": "元の文字を削除する", "ShowGeometry": true, "Id": "4db1d40c227d47608fe76ec913d3ac31", "IsSetAsInput": false, "IsSetAsOutput": false, "Excluded": false, "X": 159.0, "Y": 258.5 } ], "Annotations": [], "X": 0.0, "Y": 0.0, "Zoom": 1.0 } }