「Vla-get-activedocument」の版間の差分

提供:GizmoLabs - だいたい CAD LISP なサイト
編集の要約なし
編集の要約なし
 
(同じ利用者による、間の5版が非表示)
5行目: 5行目:


; 機能
; 機能
: 現在の CAD セッションのトップ レベルの CAD アプリケーション オブジェクトを取得する。
: アクティブなドキュメント(図面ファイル)のVLAオブジェクトを取得する。




20行目: 20行目:
(setq *ActDoc* (vla-get-activedocument (vlax-get-acad-object)))
(setq *ActDoc* (vla-get-activedocument (vlax-get-acad-object)))
#<VLA-OBJECT IDispatch 22701374>
#<VLA-OBJECT IDispatch 22701374>
; ダンプ
(vlax-dump-object *actdoc*)
; IAcadDocument: An AutoCAD drawing
; プロパティの値:
;  Active (RO) = -1
;  ActiveDimStyle = #<VLA-OBJECT IAcadDimStyle 0000000008969c38>
;  ActiveLayer = #<VLA-OBJECT IAcadLayer 0000000008968a38>
;  ActiveLayout = #<VLA-OBJECT IAcadLayout 0000000008969ba8>
;  ActiveLinetype = #<VLA-OBJECT IAcadLineType 0000000008969e78>
;  ActiveMaterial = #<VLA-OBJECT IAcadMaterial 0000000008969d58>
;  ActivePViewport = AutoCAD: ペーパー空間にアクティブなビューポートがありません
;  ActiveSelectionSet (RO) = #<VLA-OBJECT IAcadSelectionSet 00000000318792f8>
;  ActiveSpace = 1
;  ActiveTextStyle = #<VLA-OBJECT IAcadTextStyle 000000000896a148>
;  ActiveUCS = AutoCAD: オブジェクト ID が Null です
;  ActiveViewport = #<VLA-OBJECT IAcadViewport 0000000008969f98>
;  Application (RO) = #<VLA-OBJECT IAcadApplication 00000001402b91d8>
;  Blocks (RO) = #<VLA-OBJECT IAcadBlocks 000000000896a028>
;  Database (RO) = #<VLA-OBJECT IAcadDatabase 0000000031878cf8>
;  Dictionaries (RO) = #<VLA-OBJECT IAcadDictionaries 0000000008969f08>
;  DimStyles (RO) = #<VLA-OBJECT IAcadDimStyles 000000002b546a98>
;  ElevationModelSpace = 0.0
;  ElevationPaperSpace = 0.0
;  FileDependencies (RO) = #<VLA-OBJECT IAcadFileDependencies 00000000318bdeb8>
;  FullName (RO) = ""
;  Groups (RO) = #<VLA-OBJECT IAcadGroups 000000000896a0b8>
;  Height = 896
;  HWND (RO) = 2167732
;  HWND32 (RO) = 2167732
;  Layers (RO) = #<VLA-OBJECT IAcadLayers 000000002b039238>
;  Layouts (RO) = #<VLA-OBJECT IAcadLayouts 00000000089693c8>
;  Limits = (0.0 0.0 84100.0 59400.0)
;  Linetypes (RO) = #<VLA-OBJECT IAcadLineTypes 000000002b546b28>
;  Materials (RO) = #<VLA-OBJECT IAcadMaterials 000000002b616518>
;  ModelSpace (RO) = #<VLA-OBJECT IAcadModelSpace 000000002b5dd618>
;  MSpace = AutoCAD: モードが無効です
;  Name (RO) = "Drawing1.dwg"
;  ObjectSnapMode = 0
;  PaperSpace (RO) = #<VLA-OBJECT IAcadPaperSpace 000000002b5dccb8>
;  Path (RO) = "C:\\Program Files\\Autodesk\\AutoCAD Mechanical 2012"
;  PickfirstSelectionSet (RO) = #<VLA-OBJECT IAcadSelectionSet 0000000031879478>
;  Plot (RO) = #<VLA-OBJECT IAcadPlot 00000000318c0ac8>
;  PlotConfigurations (RO) = #<VLA-OBJECT IAcadPlotConfigurations 000000002b616638>
;  Preferences (RO) = #<VLA-OBJECT IAcadDatabasePreferences 00000000318bfb38>
;  ReadOnly (RO) = 0
;  RegisteredApplications (RO) = #<VLA-OBJECT IAcadRegisteredApplications 000000002b6166c8>
;  Saved (RO) = 0
;  SectionManager (RO) = 例外が発生しました。
;  SelectionSets (RO) = #<VLA-OBJECT IAcadSelectionSets 000000002b5513e8>
;  SummaryInfo (RO) = #<VLA-OBJECT IAcadSummaryInfo 000000002b262268>
;  TextStyles (RO) = #<VLA-OBJECT IAcadTextStyles 000000002b6165a8>
;  UserCoordinateSystems (RO) = #<VLA-OBJECT IAcadUCSs 000000002b616758>
;  Utility (RO) = #<VLA-OBJECT IAcadUtility 00000000318c0978>
;  Viewports (RO) = #<VLA-OBJECT IAcadViewports 000000002b616908>
;  Views (RO) = #<VLA-OBJECT IAcadViews 000000002b6167e8>
;  Width = 1525
;  WindowState = 3
;  WindowTitle (RO) = "Drawing1.dwg"
T
(vl-load-com)
(defun c:Example_ActiveDocument()
    ;; 現在の図面名を返す
    (setq acadObj (vlax-get-acad-object))
    (setq activeDoc (vla-get-ActiveDocument acadObj))
    (alert (strcat "現在の図面 : " (vla-get-Name activeDoc)))
)
</pre>
</pre>


[[Category:AutoLISP]]
[[Category:AutoLISP]]

2019年1月21日 (月) 08:37時点における最新版

構文
(vla-get-activedocument vla-object)


機能
アクティブなドキュメント(図面ファイル)のVLAオブジェクトを取得する。


引数
  • vla-object … CAD のアプリケーション オブジェクト


戻り値
アクティブドキュメントの VLA オブジェクト。


サンプル
(setq *ActDoc* (vla-get-activedocument (vlax-get-acad-object)))
#<VLA-OBJECT IDispatch 22701374>

; ダンプ
(vlax-dump-object *actdoc*)
; IAcadDocument: An AutoCAD drawing
; プロパティの値:
;   Active (RO) = -1
;   ActiveDimStyle = #<VLA-OBJECT IAcadDimStyle 0000000008969c38>
;   ActiveLayer = #<VLA-OBJECT IAcadLayer 0000000008968a38>
;   ActiveLayout = #<VLA-OBJECT IAcadLayout 0000000008969ba8>
;   ActiveLinetype = #<VLA-OBJECT IAcadLineType 0000000008969e78>
;   ActiveMaterial = #<VLA-OBJECT IAcadMaterial 0000000008969d58>
;   ActivePViewport = AutoCAD: ペーパー空間にアクティブなビューポートがありません
;   ActiveSelectionSet (RO) = #<VLA-OBJECT IAcadSelectionSet 00000000318792f8>
;   ActiveSpace = 1
;   ActiveTextStyle = #<VLA-OBJECT IAcadTextStyle 000000000896a148>
;   ActiveUCS = AutoCAD: オブジェクト ID が Null です
;   ActiveViewport = #<VLA-OBJECT IAcadViewport 0000000008969f98>
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00000001402b91d8>
;   Blocks (RO) = #<VLA-OBJECT IAcadBlocks 000000000896a028>
;   Database (RO) = #<VLA-OBJECT IAcadDatabase 0000000031878cf8>
;   Dictionaries (RO) = #<VLA-OBJECT IAcadDictionaries 0000000008969f08>
;   DimStyles (RO) = #<VLA-OBJECT IAcadDimStyles 000000002b546a98>
;   ElevationModelSpace = 0.0
;   ElevationPaperSpace = 0.0
;   FileDependencies (RO) = #<VLA-OBJECT IAcadFileDependencies 00000000318bdeb8>
;   FullName (RO) = ""
;   Groups (RO) = #<VLA-OBJECT IAcadGroups 000000000896a0b8>
;   Height = 896
;   HWND (RO) = 2167732
;   HWND32 (RO) = 2167732
;   Layers (RO) = #<VLA-OBJECT IAcadLayers 000000002b039238>
;   Layouts (RO) = #<VLA-OBJECT IAcadLayouts 00000000089693c8>
;   Limits = (0.0 0.0 84100.0 59400.0)
;   Linetypes (RO) = #<VLA-OBJECT IAcadLineTypes 000000002b546b28>
;   Materials (RO) = #<VLA-OBJECT IAcadMaterials 000000002b616518>
;   ModelSpace (RO) = #<VLA-OBJECT IAcadModelSpace 000000002b5dd618>
;   MSpace = AutoCAD: モードが無効です
;   Name (RO) = "Drawing1.dwg"
;   ObjectSnapMode = 0
;   PaperSpace (RO) = #<VLA-OBJECT IAcadPaperSpace 000000002b5dccb8>
;   Path (RO) = "C:\\Program Files\\Autodesk\\AutoCAD Mechanical 2012"
;   PickfirstSelectionSet (RO) = #<VLA-OBJECT IAcadSelectionSet 0000000031879478>
;   Plot (RO) = #<VLA-OBJECT IAcadPlot 00000000318c0ac8>
;   PlotConfigurations (RO) = #<VLA-OBJECT IAcadPlotConfigurations 000000002b616638>
;   Preferences (RO) = #<VLA-OBJECT IAcadDatabasePreferences 00000000318bfb38>
;   ReadOnly (RO) = 0
;   RegisteredApplications (RO) = #<VLA-OBJECT IAcadRegisteredApplications 000000002b6166c8>
;   Saved (RO) = 0
;   SectionManager (RO) = 例外が発生しました。
;   SelectionSets (RO) = #<VLA-OBJECT IAcadSelectionSets 000000002b5513e8>
;   SummaryInfo (RO) = #<VLA-OBJECT IAcadSummaryInfo 000000002b262268>
;   TextStyles (RO) = #<VLA-OBJECT IAcadTextStyles 000000002b6165a8>
;   UserCoordinateSystems (RO) = #<VLA-OBJECT IAcadUCSs 000000002b616758>
;   Utility (RO) = #<VLA-OBJECT IAcadUtility 00000000318c0978>
;   Viewports (RO) = #<VLA-OBJECT IAcadViewports 000000002b616908>
;   Views (RO) = #<VLA-OBJECT IAcadViews 000000002b6167e8>
;   Width = 1525
;   WindowState = 3
;   WindowTitle (RO) = "Drawing1.dwg"
T

(vl-load-com)
(defun c:Example_ActiveDocument()
    ;; 現在の図面名を返す
    (setq acadObj (vlax-get-acad-object))
    (setq activeDoc (vla-get-ActiveDocument acadObj))
    (alert (strcat "現在の図面 : " (vla-get-Name activeDoc)))
)