对INSERT实体的entmake,还有个方法啊,比命令也快
vla-insertblock
你也不用担心属性什么的问题,建议用这个替代INSERT的entmake
- InsertBlock Method
-
- Inserts a drawing file or a named block that has been defined in the current drawing.
- Signature
- VBA :RetVal = object.InsertBlock(InsertionPoint, Name, Xscale, Yscale, ZScale, Rotation)
- VL : RetVal = (vla-InserBlock object InsertionPoint Name Xscale Yscale ZScale Rotation)
- (vla-InsertBlock mspace ip thename xscale yscale zscale rot)
- Object : ModelSpace, PaperSpace, Block
- The object or objects this method applies to.
- InsertionPoint : Variant (three-element array of doubles); input-only
- The 3D WCS coordinates specifying the location in the drawing to insert the block.
- Name : String; input-only
- The name of the AutoCAD drawing file or the name of the block to insert. If it is a file name, include any path information necessary for AutoCAD to find the file and the .dwg extension.
- Xscale : Double; input-only; optional
- The default equals 1.0. Must be a positive number.
- Yscale : Double; input-only; optional
- The default equals 1.0. Must be a positive number.
- Zscale : Double; input-only; optional
- The default equals 1.0. Must be a positive number.
- Rotation : Double; input-only; optional
- The default equals 0.0 radians.
- RetVal : BlockRef object
- The placed block as a Block Reference object.
- Remarks
- Inserting a block into another block will create nested blocks.
- Attempting to call the InsertBlock method with an uninitialized Name parameter results in unexpected behavior.
复制代码 - ;Example :
- (defun c:al-insertblock ()
- (vl-load-com)
- (setq thisdrawing (vla-get-activedocument (vlax-get-acad-object)))
- (setq mspace (vla-get-modelspace thisdrawing))
- (setq util (vla-get-utility thisdrawing))
- (setq ip (vla-GetPoint util nil "\nInsertion Point: "))
- (setq thename (vla-GetString util 1 "\nBlock Name: "))
- (setq xscale (vla-GetReal util "\nX Scale Factor : "))
- (setq yscale (vla-GetReal util "\nY Scale Factor : "))
- (setq zscale (vla-GetReal util "\nZ Scale Factor : "))
- (setq rot (vla-GetReal util "\nRotation Angle : "))
- (setq theblock (vla-InsertBlock mspace ip thename xscale yscale zscale rot))
- (princ)
- )
|