Add Method

Back to Methods Reference

Creates a member object and adds it to the appropriate collection.

Signatures: Overview

Blocks
  • VBA : RetVal = object.Add(InsertionPoint, Name)
  • VL : RetVal = (vla-Add object InsertionPoint Name)

UCSs

  • VBA : RetVal = object.Add(Origin, XAxisPoint, YAxisPoint, Name)
  • VL : RetVal = (vla-Add Object Origin XAxisPoint YAxisPoint Name)

Hyperlinks

  • VBA : RetVal = object.Add(Name[, Description][, NamedLocation])
  • VL : RetVal = (vla-Add object Name Description NamedLocation)

PlotConfigurations

  • VBA : RetVal = object.Add(Name[, ModelType])
  • VL : RetVal = (vla-Add object Name ModelType)

Dictionaries, DimStyles, Documents, Groups; Layers, Layouts, Linetypes, PlotConfigurations, PopupMenus, Projects, RegisteredApps, SelectionSets, TextStyles, Toolbars, Views, Viewports

  • VBA: RetVal = object.Add(Name)
  • VL : RetVal = (vla-Add Name)

Signatures: Detail

VBA : RetVal = object.Add(InsertionPoint, Name)

VL : RetVal = (vla-Add object InsertionPoint Name)

  • Object : Blocks
    The collection to add the new object to.
  • InsertionPoint : Variant (three-element array of doubles); input-only
    The 3D WCS coordinates specifying where the Blocks Collection object will be added.
  • Name : String; input-only
    The name of the block to add to the collection.
  • RetVal : Block object
    The newly added Block object.

VBA : RetVal = object.Add(Origin, XAxisPoint, YAxisPoint, Name)

VL : RetVal = (vla-Add Object Origin XAxisPoint YAxisPoint Name)

  • Object : UCSs
    The collection to add the new object to.
  • Origin : Variant (three-element array of doubles); input-only
    The 3D WCS coordinates specifying where the UCS is to be added.
  • XAxisPoint : Variant (three-element array of doubles); input-only
    The 3D WCS coordinates specifying a point on the positive X axis of the UCS. The XAxisPoint and YAxisPoint together cannot specify the same location as the Origin.
  • YAxisPoint : Variant (three-element array of doubles); input-only
    The 3D WCS coordinates specifying a point on the positive Y axis of the UCS.
    (The Z axis follows by applying the right-hand rule.)
  • Name : String; input-only
    The name of the UCS to add to the collection.
  • RetVal : UCS object
    The newly added UCS object.

VBA : RetVal = object.Add(Name[, Description][, NamedLocation])

VL : RetVal = (vla-Add object Name Description NamedLocation)

  • Object : Hyperlinks
    The collection to add the new object to.
  • Name : String; input-only
    The name of the hyperlink to add.
  • Description : Variant; input-only; optional
    The description of the hyperlink to add.
  • NamedLocation : Variant; input-only; optional
    A given location, such as a named view in AutoCAD or a bookmark in a word processing program. If you specify a named view to jump to in an AutoCAD drawing, AutoCAD restores that view when the hyperlink is opened.
  • RetVal : Hyperlink
    The newly added object.

VBA : RetVal = object.Add(Name[, ModelType])

VL : RetVal = (vla-Add object Name ModelType)

  • Object : PlotConfigurations
    The collection to add the new object to.
  • Name : String; input-only
    The name of the object to add to the collection.
  • ModelType : Boolean; input-only; optional
    TRUE: The plot configuration applies only to the Model Space tab.
    FALSE: The plot configuration applies to all layouts.
  • RetVal PlotConfiguration
    The newly added object.

VBA : RetVal = object.Add(Name)

VL : RetVal = (vla-Add Name)

(vla-add ssets "$Set")

  • Object : Dictionaries, DimStyles, Documents, Groups; Layers, Layouts, Linetypes, PopupMenus, RegisteredApps
    , SelectionSets, TextStyles, Toolbars, Views, Viewports
    The collection to add the new object to.
  • Name : String; input-only; optional for the Documents collection.
    The name of the object to add to the collection. For the Documents collection, this name represents the name of the drawing template to use and will accept a URL address or a fully qualified path and file name.
  • RetVal : Dictionary, DimStyle, Document, Group, Layer, Layout, Linetype, PopupMenu
    , RegisteredApp, SelectionSet
    , TextStyle, Toolbar, View, Viewport
    The newly added object.

Remarks

Although you can create a linetype and add it to the Linetypes Collection object using this method, it will be created with the default properties only. Because you cannot edit properties of the Linetype object with this release of ActiveX Automation, use the Load method to load existing linetypes into your drawing.
Layers are created with default color and linetype properties. The default color is white, the default linetype is standard.
Documents collection: You cannot use the Add method for the Documents collection while in SDI mode. When in SDI mode, use the Open method on the Document object. When accessing a secure URL a dialog box will be posted prompting the user for the necessary password information. Message boxes may also appear if the user has not suppressed this activity in their browser. When downloading a file, AutoCAD creates a temporary file for internal processing. Do not attempt to access this temporary file. Information in this file is deleted at the end of the AutoCAD session.

Example :


(defun c:al-add ()

(vl-load-com)

(setq thisdrawing (vla-get-activedocument
     (vlax-get-acad-object)))

(setq ssets (vla-get-selectionsets thisdrawing))

(if (vl-catch-all-error-p 
    (vl-catch-all-apply 'vla-item (list ssets "$Set")))

  (setq newSet (vla-add ssets "$Set"))
  
     (progn
       
    	(vla-delete (vla-item ssets "$Set"))
       
  	(setq newSet (vla-add ssets "$Set"))
       
     );progn

);if

(vla-SelectOnScreen newSet)

(princ)

);defun

 
The AutoLisp/Visual Lisp/VBA Resource Website
Google
Search the WWW Search AfraLisp

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website