Showing posts with label LISP. Show all posts
Showing posts with label LISP. Show all posts

Wednesday, April 30, 2008

Max AutoCAD entity handle number

The handle value is stored as a 64 bit number (8 bytes) in the DWG file no matter if you run 32-bit or 64-bit AutoCAD. The maximum value for a handle is: "FFFFFFFFFFFFFFFF" as hexadecimal or 6744073709551615 as integer.

If you for example use the LIST command you see the handle listed:
Handle = 1e9

Or if you list the properties using AutoLISP:
(entget(car(entsel)))
that can give a result like this:
(5 . "1E9")

If you with AutoLISP want to delete an object based on its handle ("1E9") this can be used:
(entdel(handent "1e9"))

The last tip can be useful if you have a problem with for example:
*Warning* Multiply owned object, handle "1e9"

Thursday, April 24, 2008

LTCCLispWiki a free lisp source code repository

You find the Wiki launched by Greg Robinson at http://lispwiki.com. As the startup page is not much edited click on All Pages on the left side.

Greg Robinson's "LTCC was instrumental in creating the Bonus Tools program extension to AutoCAD release 14, which continues to be part of the core software package as 'Express Tools'"

I contributed with my hatchb.lsp as a starter.

Monday, April 07, 2008

Acrobat PDFMaker 8.0 toolbar in AutoCAD 2009 and CUI bugs

If you want the Acrobat PDFMaker 8.0 toolbar in AutoCAD 2008 or AutoCAD 2009 here is how you can do it. It requires that you have Adobe Acrobat 8.0.

With some work I achieved this result and unfortunately it was not because CUI was so stable and easy to use. But it is also AutoCAD Ribbon version 1 so hopefully this works better after some hotfixes, service packs or at least in AutoCAD 2010.

Ribbon

As a starter use the APPLOAD command. Click on Startup Suit Contents and add "C:\Program Files\Adobe\Acrobat 8.0\PDFMaker\AutoCAD\2007\PDFMAcad.arx".

It should then look like this on the command line:
Command: appload
PDFMAcad.arx was added to the Startup Suite.

This created some menu files and images in this folder on my PC:
C:\Users\<user>\appdata\roaming\adobe\acrobat\8.0\ACAD-7001-409

In AutoCAD 2009 it will look this this with the Acrobat PDFMaker 8.0 toolbar loaded.

Acrobat PDFMaker 8.0

Now I want to move the toolbar to the Ribbon.

Run the CUI command. Select pdfmacad.cui.

Right-click on the toolbar Acrobat PDFMaker 8.0.

image

Right-click on Ribbons Tabs and add a new tab named "PDF".

image

Drag and drop the ribbon panel that was created into the PDF tab.

image 

Click on Apply.

Select All Customization Files and click on the current workspace and you find that you see the right pane change.

image 

Select pdfmacad.cui again. Here you should be able to click on Customize Workspace on the right pane but I got an error. Instead expand Ribbons Tab on the left side so you see "PDF". Drag and drop that one to the right side on the Ribbons Tab there.

image

image 

Looking in CUI two panels are listed. One is unnamed that obviously just creates an empty panel and cannot be deleted. Another bug.

image

The workaround was to click on it and set the Show property to No.

image

Now I want to make the icons side by side and add some text below.

image

I try to drag the command on Row 2 to Row 1 but nothing happens. Another bug as I can drag the command from Row 1 down to Row 2.

After deleting Row 1 and showing the text it look like this.

image

But I don't want a separate Tab. I would like to move it to the Output tab.

I tried different methods like transferring the panels between the cui files but even though it looked right in CUI the result was just an empty panel on the Ribbon tab. Buggy again.

I even tried another approach.but was not able to get it to work because of several bugs in CUI.

Right click on the toolbar and select Customize.

Customize

In Customize User Interface (CUI) expand "Customizations in All CUI Files" and the right part of CUI by clicking on the black arrow at the bottom.

Click on the command "Convert to Adobe PDF" so you see the Button Image.

image

Click on Edit and in the next dialog box click on Save As and place the image where you can find it later. Do the same with the command "Convert to Adobe PDF and Send for Review". Notice that if you in the button image editor click on Save As the first time you end up in you Documents folder. If you cancel it and click again you end up in the Icons folder. Bug again.

One location could be something like this if you have Windows Vista:
C:\Users\<UserName>\AppData\Roaming\Autodesk\AutoCAD 2009\R17.2\enu\Support\Icons

Click OK to make sure things are saved and that the next step will work. If not you will get the menu file corrupted in the following steps due to some bug.

Start CUI again by right clicking on the toolbar like before and expand the panes.

Now right click on "Acrobat PDFMaker 8.0" as seen below and select "Copy To Ribbon Panels".

CUI Copy To Ribbon Panels

Now the Ribbon Panel "Acrobat PDFMaker 8.0" is available.

Acrobat PDFMaker 8.0

Right click on it and select Copy.

Navigate now to the Ribbon Tabs and locate Output -2D and select it. Right click and select Paste.

Output - 2D

Bummer. It didn't work either. To achieve the best result you should create the Ribbon Panel manually.

Wednesday, March 26, 2008

Usage of mpt.lsp in AutoCAD

I got the following question regarding the free AutoLISP program mpt.lsp.

"I don't understand the use of these. How do I use them in a way that does not cancel my running command?"

I guess it could be that this user added for example the command MPT to a menu using ^C^CMPT. To have the command running transparently it needs to be 'MPT instead.

Below is a small video showing the usage of the four helper commands:

  • MPT - Midpoint of 2 points
  • 3PT - 1/3:rd point of 2 points
  • 4PT - 1/4:th point of 2 points
  • MPT3 - Midpoint of 3 points

First mpt.lsp needs to be loaded and acaddoc.lsp is a good way or the APPLOAD command's Startup Suit.

CUI can be used to create a command that is then added to the Object Snap Cursor Menu.

 CUI

And now it is available on the object snap menu.

Right click menu

I used AutoCAD 2009 in this short demonstration.

Tuesday, March 11, 2008

AutoCAD Automation Tools released

AutoCAD Automation Tools are some tools for AutoCAD that JTB World have released that can be a real time saver if you need to make justifications on hundreds or thousands of drawings.

Typical usages are if you have a template drawing but text in the title block and some attributes or other text needs to be different on each drawing. Use for example Excel to enter or populate all values. Depending on your computer performance and the complexity of the drawing you can generate around 100 drawings in just 60 seconds.

AutoGen Excel template

You can change text or attribute values on a lot of drawings. It could update a title block with revision, date or some names for example.

You can add text, blocks or xrefs to existing drawings.

It works with AutoCAD 2000 or later (tested also with AutoCAD 2009) or verticals based on AutoCAD.

The AutoCAD Automation Tools are great for the CAD manager or administrator but also very easy for any AutoCAD user to use.

Friday, February 29, 2008

Autodesk introduces VSTA

No VSTA (Visual Studio Tools for Applications) in AutoCAD 2009. I read in the CAD Application Development blog that Revit 2009 has it. That means probably AutoCAD 2010 will introduce VSTA unless Autodesk put resources on other things. AutoCAD have at least VBA and AutoLISP something Revit does not have.

Friday, January 18, 2008

Automate testing of GUI

I just subscribed to http://acadguitest.blogspot.com/. I'm looking forward to read more about his finds on "how to test your AutoCAD applications (AutoLISP, VBA, .NET or ObjectARX) against AutoCAD interface."

Fernando Malard have started looking at AutoIt that is a great product for automation.

Via CADptbr

Tuesday, January 15, 2008

What LUPREC is and what it can do in AutoLISP

I got a question on how to change BomLengths.lsp to not show decimals.

BomLengths.lsp is a freeware that reports the accumulated sum length of multiple objects. As default it uses the current number of decimals according to the LUPREC value.

The solution is the following:

Change the following rows
(princ (rtos %l (getvar "lunits")(getvar "luprec")))
and
(princ (rtos %t (getvar "lunits")(getvar "luprec")))

to

(princ (rtos %l (getvar "lunits") 0))
and
(princ (rtos %t (getvar "lunits") 0))

According to the manual on luprec:

Sets the number of decimal places displayed for all read-only linear units, and for all editable linear units whose precision is less than or equal to the current LUPREC value. For editable linear units whose precision is greater than the current LUPREC value, the true precision is displayed. LUPREC does not affect the display precision of dimension text (see DIMSTYLE).

Monday, January 14, 2008

Lambda expressions and mapcar with VB.NET in VS 2008

I've started to work with Visual Studio 2008 and it's great to see that lambda expressions are supported, something I'm familiar with using in AutoLISP.

I also made a simple .NET variant of the mapcar function. If you have another way or better way let me know.

Module Module1 Sub Main() Dim f1 = Function(i, j) If(i >= j, i & " is " & j & " or more", i & " is less than " & j) Console.WriteLine(f1(1, 0)) Console.WriteLine(f1(-1, 1)) Dim s1 = Function(x, y) x + " " + y Console.WriteLine(s1("Jimmy", "Bergmark")) Dim res() As Object = mapcar(Function(x) x * 2, New Integer() {35, 55, 21, 30}) For Each r In res Console.WriteLine(r) Next Dim mult As Func(Of Integer, Func(Of Integer, Integer)) = Function(x As Integer) Function(y As Integer) x * y Dim mult_2 = mult(2) Dim r1 = mult_2(4) ' r1 is now 8 Console.ReadLine() End Sub Function mapcar(ByVal f As Func(Of Object, Object), ByVal ParamArray x() As Object) As Array Dim res(UBound(x(0))) As Object For i As Integer = 0 To UBound(x(0)) res(i) = f(x(0)(i)) Next i Return res End Function End Module

Here is the output of the code.

output

Tuesday, January 08, 2008

Visual Studio 2008 Shell

Visual Studio 2008 Shell is a new Microsoft product (to be released) based on Visual Studio 2008. Maybe something for Autodesk to make use of instead of the old VLIDE (that is not improved much) and VBAIDE.

"The Visual Studio Shell accelerates development by providing a base integrated development environment that can host custom tools and programming languages."

This means that AutoLISP could be added to this environment.

"Created in response to requests from our partners" - Maybe Autodesk already is working on this...

Visual Studio Shell (isolated mode)

Wednesday, December 19, 2007

Change the title of your AutoCAD application

I got an email the other day asking if I still had this code around. Yes it is. Why is it useful. One reason is that you might want to take snapshots without the text "NOT FOR RESALE". Another is that you want to brag about having AutoCAD 2009 a few months earlier than the most or just play a prank.

Here is what it look like before running the command.
It says AutoCAD 2008 - NOT FOR RESALE.

AutoCAD 2008

After running the command JTB_SetTitleBarAutoCAD2009 based on the code found on my website it look like this and says AutoCAD 2009.

 AutoCAD 2009

I modified JTB_TitleBar.lsp to this:

(defun c:JTB_SetTitleBarAutoCAD2009() (vl-load-com) (setq JTB_TitleBar "AutoCAD 2009") (vl-vbarun "C:/JTB World/JTB_TitleBar2005.dvb!JTB_TitleBar") (princ) )

Saturday, December 08, 2007

Make changes to a drawing without changing DBMOD

In an earlier post about layer notification I mentioned how to us acaddoc.lsp to disable unreconciled layer evaluation and notification. In AutoCAD Insider I read about how this makes changes to the drawing so that if you just open a drawing and then try to close it you will be asked to save changes.

One way to partially solve this is to only make changes if there is a need to change.

(if (/= (getvar "LAYEREVAL") 0) (setvar "LAYEREVAL" 0))
(if (/= (getvar "LAYERNOTIFY") 0) (setvar "LAYERNOTIFY" 0))

If you completely want to trick AutoCAD to think no changes has been done to the drawing you can achieve this using (acad-push-dbmod) to store the modification status of a drawing and finally (acad-pop-dbmod) to restore the original status.

If you start a new drawing and run (setvar "LAYEREVAL" 0) you will find that the DBMOD system variable changes to 4. But if enclosed with (acad-push-dbmod) and (acad-pop-dbmod) no changes will be made to DBMOD and you will be able to close the drawing without any "problem". You have to do something else with the drawing to trigger AutoCAD to ask you to save the drawing if you just close it.

Here is an example of what you can add into acaddoc.lsp.

(acad-push-dbmod)
(setvar "LAYEREVAL" 0)
(setvar "LAYERNOTIFY" 0)
(acad-pop-dbmod)
(princ "\nacaddoc.lsp loaded")
(princ)

Saturday, November 10, 2007

AutoLISP.NET

Wondering when we might see AutoLISP for .NET from Autodesk. Possibly at the same time when support for VBA is removed and support for VSTA (Visual Studio Tools for Applications) comes for AutoCAD and why not for Revit. It would really be a great step forward for AutoLISP to also have access to the complete .NET Framework.

Rob Blackwell speaks about "If time was more plentiful I’d certainly be thinking about building a LISP or LSharp IDE using Visual Studio Extensibility."

Monday, November 05, 2007

Add personal mtext symbols or text snippets in AutoCAD

If you right click in the mtext editor or click on the symbol icon a list of predefined symbols is showed. It is possible to add your own symbols or text snippets to that list.

I can confirm that it still works with AutoCAD 2008. For some reason it didn't work in AutoCAD 2007 and I'm not sure if it works in AutoCAD 2006.

To have this work you need to use the AutoLISP code found at
http://www.jtbworld.com/lisp/PersonalMtextSymbols.htm

Below is a cheat sheet showing what the symbols look like. (For a future version of AutoCAD it would be great to also see the symbols instead of the cryptic text codes)

The symbols are Degrees,Plus/Minus,Diameter,Almost Equal,Angle,Boundary Line,Center Line,Delta,Electric Phase,Flow Line,Identity,Initial Length,Monument Line,Not Equal,Ohm,Omega,Property Line,Subscript 2,Squared and Cubed.

Wednesday, October 10, 2007

AreaText.LSP for AutoCAD

Here is a small AutoLISP program I did a while ago. It's freeware so just grab it, use it, change it or contact me if you want something else to be done.

AreaText.LSP

It makes use of the FIELD functionality in AutoCAD but makes this specific operation easy and quick.

Run the command AT and select a polyline and then where to place the text.

The result is in SQ. FT. but the AutoLISP code can easily be changed for other formats.

image

When the polyline is changed the area is updated

image

Wednesday, October 03, 2007

Review of Dynamsoft software version control

imageI've started to try Dynamsoft SourceAnywhere Hosted and will post more as I continue using it.

I use it together with Visual Studio 2005 but also with other file formats like AutoLISP (Visual LISP) files. There is no limitation on what type of files that can be hosted.

It was very straight forward and intuitive to start using SourceAnywhere Hosted. So far so good.

dynamsoft

If you too want to try it they have a Free Hosting Plan for up to to 3 users and 15M storage space.

image

Disclaimer. I was offered for free a plan of Dynamsoft SourceAnywhere Hosted that receives the same service as the paid account.

Wednesday, September 12, 2007

AutoCAD hyperlink command advanced

If the basics is not enough here comes most everything else worth knowing about hyperlinks in AutoCAD.

Here is a sample code that can be used in CUI (Customize User Interface) as a Double Click Action macro instead of the default one ^C^C_properties. If the object has a hyperlink it will be opened and if not the Properties palette will be opened.

^C^C(if (setq path (cdr (cadadr (assoc -3 (entget (ssname (ssget "P") 0) '("PE_URL")))))) (command "BROWSER" path) (command "PROPERTIES"))

If you want to create a hyperlink to a named location in a non-AutoCAD file add a pound sign (#) after the name of the file that the hyperlink is linked to. Here is a sample for Excel:
C:\Documents\MyBook1.xls#Sheet1!C10
It will open MyBook1.xls, sheet1 and locate the cell C10.
or to Word:
C:\Documents\MyDocument.doc#MyBookmark
C:\Documents\MyDocument.doc#3
    (opens page 3)
or a PDF file in Adobe Reader or Adobe Acrobat
C:\Documents\myFile.pdf#page=3

To find all objects that are hyperlinked use QSELECT and since there is no operator to select all objects with a hyperlink you can select Not Equal and enter a Value you know does not exist.

 image

With the -HYPERLINK command you can insert hyperlinks on objects and this can be automated like this with AutoLISP:
(command "-HYPERLINK" "I" "O" ent "" "" "Detail 1" "Detail 1")

Using the -HYPERLINK Insert option:

Command: -hyperlink
Enter an option [Remove/Insert] <Insert>: i
Enter hyperlink insert option [Area/Object]: O
Select objects: 1 found
Select objects:
Enter hyperlink <current drawing>:
Enter named location <none>: Detail 1
Enter description <none>: Detail 1

Notice that you have an Area option. That will ask you for First corner and Other corner and create a 3D Polyline on the layer URLLAYER. The URLLAYER is automatically created. When is this useful. For example if you plot to DWF you will find that you can click anywhere in that area and the 3D Polyline will not be visible.

image

Using the -HYPERLINK Remove option:

Command: -hyperlink
Enter an option [Remove/Insert] <Insert>: R
Select objects: Specify opposite corner: 7 found
Select objects:
1.  TANK 3 (TANK 3)
2.  TANK 2 (TANK 2)
3.  http://www.jtbworld.com (jtbworld.com)
4.  http://www.jtbworld.com (jtbworld.com)
5.  http://www.jtbworld.com (jtbworld.com)
6.  TANK 1 (TANK 1)
7.  http://www.jtbworld.com (jtbworld.com)

Enter number, hyperlink, or * for all: http://www.jtbworld.com
4 hyperlinks deleted.

With the DETACHURL command you can delete hyperlinks from objects and this can be automated like this:
(command "DETACHURL" ent "")

If a drawing has had hyperlinks the Registered application PE_URL can be purged.

Command: -purge
Enter type of unused objects to purge
[Blocks/Dimstyles/LAyers/LTypes/MAterials/Plotstyles/SHapes/textSTyles/Mlinestyles/Tablestyles/Visualstyles/Regapps/All]: r
Enter name(s) to purge <*>:
Verify each name to be purged? [Yes/No] <Y>: Y
Purge registered application "PE_URL"? <N> Y

HYPERLINKBASE - Specifies the path used for all relative hyperlinks in the drawing. If no value is specified, the drawing path is used for all relative hyperlinks.

Or use DWGPROPS and on the Summary tab, enter a relative path in Hyperlink Base.

HYPERLINKOPEN - Asks for a hyperlink and opens it or navigates to that location that could be a named view or layout tab.

Command: HYPERLINKOPTIONS
Display hyperlink cursor, tooltip, and shortcut menu? [Yes/No] <Yes>:

PASTEASHYPERLINK - Inserts data from the Clipboard as a hyperlink. Example. Copy a file in Explorer and run the command or select Edit>Paste as Hyperlink and then select one or several objects. Now a hyperlink to the document will be inserted on the object(s).

AutoLISP

And now into more details how to use entget to find the information. The hyperlink information is attached as xdata.

If you want to know how many hyperlinked objects there are use:
(sslength (ssget "x" '((-3 ("PE_URL")))))

Command: (assoc -3 (entget (car (entsel)) (list "PE_URL")))
Select object:
(-3 ("PE_URL" (1000 . "http:// www.autodesk.com") (1002 . "{") (1000 . "Autodesk") (1002 . "{") (1071 . 0) (1002 . "}") (1002 . "}")))

And this is an example how the hyperlink is to the view named Detail 1 in the current drawing.

Command: (assoc -3 (entget (car (entsel)) (list "PE_URL")))
Select object:
(-3 ("PE_URL" (1000 . "") (1002 . "{") (1000 . "Detail text display") (1000 . "Detail 1") (1002 . "{") (1071 . 1) (1002 . "}") (1002 . "}")))

To make sure the option Convert Hyperlink to DWF is always set the code below is needed.

(defun markHlinkDWF ()
  (setq mysel (ssget "_X" '((-3 ("PE_URL")))))
  (setq iMaxSel (sslength mysel))
  (setq iCnt 0)
  (while (< iCnt iMaxSel)
    (setq my_entname (ssname mysel iCnt))
    (setq my_ent (entget my_entname '("PE_URL")))
    ;; get the entity including Xdata for hlinks
    (setq my_xdata1 (assoc -3 my_ent))
    ;; open up the XData
    (setq my_xdata_URL (nth 1 my_xdata1))
    (setq my_new_xdata_URL (subst '(1071 . 1) '(1071 . 0) my_xdata_URL))
    ;; enable flag for convert DWG to DWF
    (setq my_new_xdata1 (subst my_new_xdata_URL my_xdata_URL my_xdata1))
    ;; update XData
    (setq my_ent (subst my_new_xdata1 my_xdata1 my_ent))
    (entmod my_ent)
    ;; set the entity
    (setq iCnt (+ iCnt 1))
  )
  nil
)
(defun validate	()
  (setq mysel (ssget "_X" '((-3 ("PE_URL")))))
  (setq iMaxSel (sslength mysel))
  (setq iCnt 0)
  (setq iFailCnt 0)
  (while (< iCnt iMaxSel)
    (setq my_entname (ssname mysel iCnt))
    (setq my_ent (entget my_entname '("PE_URL")))
    ;; get the entity including Xdata for hlinks
    (setq my_xdata1 (assoc -3 my_ent))
    ;; open up the XData
    (setq my_xdata_URL (nth 1 my_xdata1))
    (if	(/= (member '(1071 . 0) my_xdata_url) nil)
      (setq iFailCnt (+ iFailCnt 1))
    )
    (setq iCnt (+ iCnt 1))
  )
  (if (> iFailCnt 0)
    (progn
      (setq
	my_str (strcat (itoa iFailCnt) " hyperlink(s) not updated.")
      )
      (princ my_str)
      nil
    )
  )
)

(setq Hyplink (markHlinkdwf))
(setq Hyplinkval (validate))

Here is how a hyperlink can be attached to an object.

(if (null (tblsearch "appid" "PE_URL"))
  (regapp "PE_URL")
)

(entmod
  (append (entget (car (entsel)))
    (list (list -3 (cons "PE_URL" (list
      ; URL
      (cons 1000 "http:// www.autodesk.com")
      ; Tooltip
      (cons 1002 "{")
      (cons 1002 "}")
    ))))
  )
)

There are other methods as well using Visual LISP extensions to AutoLISP (vl-load-com).

You can look at using:
vla-get-HyperlinkBase
vla-get-HyperlinkDisplayCursor
vla-get-HyperlinkDisplayTooltip
vla-get-Hyperlinks
vla-put-HyperlinkBase
vla-put-HyperlinkDisplayCursor
vla-put-HyperlinkDisplayTooltip

VBA

VBA Hyperlinks Example from the AutoCAD Developer Documentation

Sub Example_HyperLinks()
    ' This example creates a Circle object in model space and
    ' adds a new Hyperlink to its Hyperlink collection
    
    Dim Hyperlinks As AcadHyperlinks
    Dim Hyperlink As AcadHyperlink
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim HLList As String
    
    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius = 5#
    
    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)

    ThisDrawing.Application.ZoomAll
    
    ' Get reference to the Circle's Hyperlinks collection
    Set Hyperlinks = circleObj.Hyperlinks
    
    ' Add a new Hyperlink complete with all properties
    Set Hyperlink = Hyperlinks.Add("AutoDesk")
    Hyperlink.URL = "www.autodesk.com"
    Hyperlink.URLDescription = "Autodesk Main Site"
    Hyperlink.URLNamedLocation = "MY_LOCATION"
    
    ' Read and display a list of existing Hyperlinks and
    ' their properties for this object
    For Each Hyperlink In Hyperlinks
        HLList = HLList & "____________________________________" & vbCrLf   ' Separator
        HLList = HLList & "URL: " & Hyperlink.URL & vbCrLf
        HLList = HLList & "URL Description: " & Hyperlink.URLDescription & vbCrLf
        HLList = HLList & "URL Named Location: " & Hyperlink.URLNamedLocation & vbCrLf
    Next
    
    MsgBox "The circle has " & Hyperlinks.count & " Hyperlink: " & vbCrLf & HLList
End Sub

VBA HyperlinkBaseExample from the AutoCAD Developer Documentation

Sub Example_HyperlinkBase()
	' This example shows how to access drawing properties
            
	' Add and display standard properties
	ThisDrawing.SummaryInfo.Author = "John Doe"
	ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
	ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
	ThisDrawing.SummaryInfo.Keywords = "Building Complex"
	ThisDrawing.SummaryInfo.LastSavedBy = "JD"
	ThisDrawing.SummaryInfo.RevisionNumber = "4"
	ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
	ThisDrawing.SummaryInfo.Title = "Building Five"

	Author = ThisDrawing.SummaryInfo.Author
	Comments = ThisDrawing.SummaryInfo.Comments
	HLB = ThisDrawing.SummaryInfo.HyperlinkBase
	KW = ThisDrawing.SummaryInfo.Keywords
	LSB = ThisDrawing.SummaryInfo.LastSavedBy
	RN = ThisDrawing.SummaryInfo.RevisionNumber
	Subject = ThisDrawing.SummaryInfo.Subject
	Title = ThisDrawing.SummaryInfo.Title
	MsgBox "The standard drawing properties are " & vbCrLf & _
		    "Author = " & Author & vbCrLf & _
		    "Comments = " & Comments & vbCrLf & _
		    "HyperlinkBase = " & HLB & vbCrLf & _
		    "Keywords = " & KW & vbCrLf & _
		    "LastSavedBy = " & LSB & vbCrLf & _
		    "RevisionNumber = " & RN & vbCrLf & _
		    "Subject = " & Subject & vbCrLf & _
		    "Title = " & Title & vbCrLf

	' Add and display custom properties
	Dim Key0 As String
	Dim Value0 As String
	Dim Key1 As String
	Dim Value1 As String
	Dim CustomPropertyBranch As String
	Dim PropertyBranchValue As String
	Dim CustomPropertyZone As String
	Dim PropertyZoneValue As String

	CustomPropertyBranch = "Branch"
	PropertyBranchValue = "Main"
	CustomPropertyZone = "Zone"
	PropertyZoneValue = "Industrial"

	' Add custom properties
	If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
		ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
	Else
		ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
	End If

	If (ThisDrawing.Summa