Autodesk论坛中看到的一段代码,留存备用

原帖

(defun c:test ()

  (setq ad (_GetAeccDocument))		;Get the Aecc Document

  (setq s (vlax-get-property ad 'Settings))
					;Get the aecc settings from the Aecc Document					

  (setq ds (vlax-get-property s 'DrawingSettings))
					;Get the Drawing Settings from the aecc settings
  (setq as (vlax-get-property ds 'AbbreviationSettings))
					;Get the abbreviation settings from the drawing settings
  (setq alignAbbrev (vlax-get-property as 'AlignmentAbbreviations))
					;Get the Alignment abbreviations from the abbreviation settings
  (setq alignBeg (vlax-get-property alignAbbrev 'AlignmentBeginning))
					;Get the alignment beginning abbreviation from the alignment abbreviations
  (princ (strcat "
Current AlignmentBeginning Abbreviation: "
		 alignBeg
	 )
  )					;Print the current value of the alignment beginning abbreviation 
  (vlax-put-property alignAbbrev 'AlignmentBeginning "BEG")
					;Set the value of the Alignment Beginning abbreviation
  (princ
    (strcat "
New AlignmentBeginning Abbreviation: "
	    (vlax-get-property alignAbbrev 'AlignmentBeginning)
    )
  )					;Print the new value of the alignment beginning abbreviation
  (princ)				;exit clean
)

(defun _GetAeccDocument	()
  (setq	C3D (strcat "HKEY_LOCAL_MACHINE\"
		    (if	vlax-user-product-key
		      (vlax-user-product-key)
		      (vlax-product-key)
		    )
	    )
	C3D (vl-registry-read C3D "Release")
	C3D (substr
	      C3D
	      1
	      (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1))
	    )
	C3D (vla-getinterfaceobject
	      (vlax-get-acad-object)
	      (strcat "AeccXUiLand.AeccApplication." C3D)
	    )
  )
  (vlax-get-property C3D 'ActiveDocument)
)

2020年2月19日

留存这段代码是准备翻译成.net语言的,

刚搜索了一下其中个别方法,

vlax-product-key

可以用Autodesk.AutoCAD.Runtime.SystemObjects.DynamicLinker.ProductKey

或者Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.Current.UserRegistryProductRootKey

原帖在此,上面的方法是够可行还没进行验证。

原文地址:https://www.cnblogs.com/myzw/p/11307011.html