Hello everyone,
This is hopefully an easy answer. I am having trouble inserting a variable after setting it. After setting a variable using the VAREDIT, for example, "USERI1" to a number (maybe the total number of sheets I am using), how can I insert that variable into my drawing? I am drawing a total blank but I have done it before.
Thanks guys
It's not clear to me how you want to incorporate the variable value in the drawing, e.g. as a block attribute, text object, or something else. As far as extracting variable values goes, you can use the AutoLISP getvar function. A command line example:
(getvar "USERR1")
This would return the value of USERR1 as a number.
I don't think raw AutoCAD provides any other way of doing this, though maybe C3D does. Otherwise, I think you're left to AutoLISP or other programmatic approaches.
Jim Frame, post: 409808, member: 10 wrote: It's not clear to me how you want to incorporate the variable value in the drawing, e.g. as a block attribute, text object, or something else. As far as extracting variable values goes, you can use the AutoLISP getvar function. A command line example:
(getvar "USERR1")
This would return the value of USERR1 as a number.
I don't think raw AutoCAD provides any other way of doing this, though maybe C3D does. Otherwise, I think you're left to AutoLISP or other programmatic approaches.
I think you are right. Sometimes I really miss TerraModel and older AutoCAD.
I'll make the assumption that you're talking about using it as a field for a text object. While some system variables can be used as text fields, the USER variables can not. If you want to see which variables are available, try to edit a text object, right click, choose Insert Field, then under Field Category select Other, then System Variable. This will give you a list of variable which you can use for fields.
If this is the path that you are seeking, then I would suggest either using Drawing Properties or Sheet Set Manager instead of a USER system variable. I can shed more light if you're intererested.
BlitzkriegBob, post: 409815, member: 9554 wrote: I'll make the assumption that you're talking about using it as a field for a text object. While some system variables can be used as text fields, the USER variables can not. If you want to see which variables are available, try to edit a text object, right click, choose Insert Field, then under Field Category select Other, then System Variable. This will give you a list of variable which you can use for fields.
If this is the path that you are seeking, then I would suggest either using Drawing Properties or Sheet Set Manager instead of a USER system variable. I can shed more light if you're intererested.
This is exactly what I am looking for. I apologize for misstating what I meant. I was (an am) having trouble saying what I mean for some reason with this.
BlitzkriegBob, post: 409815, member: 9554 wrote: I'll make the assumption that you're talking about using it as a field for a text object. While some system variables can be used as text fields, the USER variables can not. If you want to see which variables are available, try to edit a text object, right click, choose Insert Field, then under Field Category select Other, then System Variable. This will give you a list of variable which you can use for fields.
If this is the path that you are seeking, then I would suggest either using Drawing Properties or Sheet Set Manager instead of a USER system variable. I can shed more light if you're intererested.
Let me expand a little further on this. The example I am trying this out on is a paper space that has a Sheet X of X on the Title Block. We are continuously adding sheets and having to change the final number. I want to be able to set a variable and call that out so I don't have to go through 20+ sheets and change one number. I hope this makes sense.
The AutoCAD I used previously had a LISP routine that allowed for something like this. TerraModel had it built in. I am hoping Carlson can achieve the same outcome.
Too often people think that something like this would be a function of Carlson. It is not. It is a function of Autocad. Carlson does have fields, but it is a pathetically short list. The answer to your question does depend on the CAD engine you are using with Carlson. Are you using it with Intellicad (I don't think it's possible, but I have very little experience with Intellicad), the OEM version (I have no experience with this so I would not be able to suggest anything), or with full blown Autocad (I can definitely answer if you are using this)?
BlitzkriegBob, post: 409824, member: 9554 wrote: Too often people think that something like this would be a function of Carlson. It is not. It is a function of Autocad. Carlson does have fields, but it is a pathetically short list. The answer to your question does depend on the CAD engine you are using with Carlson. Are you using it with Intellicad (I don't think it's possible, but I have very little experience with Intellicad), the OEM version (I have no experience with this so I would not be able to suggest anything), or with full blown Autocad (I can definitely answer if you are using this)?
Thanks for all your quick responses. I am just getting the feel for Carlson (1st time user). I do miss AutoCAD already.
The Carlson we are using is "Carlson Survey 2013 Powered by AutoCAD OEM 2013 Engine." Hopefully this is enough to distinguish which version I have.
I don't know if Sheet Set Manager is available with the OEM version. That is the method I prefer, but I will explain how to set it up using Drawing Properties, assuming that is available. The command line entry is dwgprops. Look for the Custom tab at the top. Use the Add button to make a property for, as an example, Total Sheets, and give it the desired value.
Create a text object in the location for total sheets, and right click to Insert Field. In the Field Category, choose Document. Select Total Sheets, then OK. Copy this text object to all your sheets. This will be dynamic, so if your sheet count changes, pull up your Drawing Properties again and change the value.
I use this method to fill in variable such as Designed By, Drawn By, Checked By, etc.
There can be bumps down this road. If you are applying this to existing sheets, you would either need to create these custom properties in each drawing file, or use the Propulate command. You can add these custom properties to your template so that any future drawings already have these.
Hope that helps. If SSM is available with the OEM version, let me know and I will offer up other suggestions.
BlitzkriegBob, post: 409836, member: 9554 wrote: Create a text object in the location for total sheets, and right click to Insert Field.
I no longer use AutoCAD, but in BricsCAD fields are only available in MTEXT objects. They're not available for TEXT objects.
Jim Frame, post: 409838, member: 10 wrote: I no longer use AutoCAD, but in BricsCAD fields are only available in MTEXT objects. They're not available for TEXT objects.
Good to know. With full blown Autocad, they are available for either. For the OP, perhaps you may need to use MText rather than just Text in the OEM version.
BlitzkriegBob, post: 409836, member: 9554 wrote: ...
Create a text object in the location for total sheets, and right click to Insert Field. In the Field Category, choose Document. Select Total Sheets, then OK. Copy this text object to all your sheets. This will be dynamic, so if your sheet count changes, pull up your Drawing Properties again and change the value.I use this method to fill in variable such as Designed By, Drawn By, Checked By, etc.
There can be bumps down this road. If you are applying this to existing sheets, you would either need to create these custom properties in each drawing file, or use the Propulate command. You can add these custom properties to your template so that any future drawings already have these.
Hope that helps. If SSM is available with the OEM version, let me know and I will offer up other suggestions.
Man, this is EXACTLY what I want to do... However, both Text and Mtext do not give me an option when I right click this. Am I missing something?
I can't really answer that since I have never used the OEM version, so I don't know what's available and what isn't. Perhaps someone else who does use the OEM can chime in.
Is Sheet Set Manager included with the OEM?
I spent quite a bit of time cobbling together a system to do just what you want. It involves running a lisp routine called PlotSheetCountReactor.lsp that establishes a lisp variable named plotsheetcount:value which can be called into a field, the resulting field expression is:
%%
editing the acad.pgp file to call PlotSheetCountReactor.lsp ensures that your "of sheet" number is always correct at the time of any plot, publish, preview or regen.
the code:
;;; ------------------------------------------------------------------------
;;; PlotSheetCountReactor.lsp v1.0
;;;
;;; Copyrightå© 10.02.09
;;; Alan J. Thompson (alanjt)
;;; alanjt@gmail.com
;;;
;;; Permission to use, copy, modify, and distribute this software
;;; for any purpose and without fee is hereby granted, provided
;;; that the above copyright notice appears in all copies and
;;; that both that copyright notice and the limited warranty and
;;; restricted rights notice below appear in all supporting
;;; documentation.
;;;
;;; The following program(s) are provided "as is" and with all faults.
;;; Alan J. Thompson DOES NOT warrant that the operation of the program(s)
;;; will be uninterrupted and/or error free.
;;;
;;; Plot reactor that will update the variable 'PlotSheetCount:Value' with
;;; the current total number of layouts in drawing. User can utilize the
;;; Lisp Variable Field option to display value in title block for total sheets.
;;;
;;; Attribute Field Example (v2009): %%
;;;
;;; Revision History:
;;;
;;; ------------------------------------------------------------------------
(vl-load-com)
;; activate reactor
(or PlotSheetCount:Reactor
(setq PlotSheetCount:Reactor
(vlr-command-reactor
nil
'((:vlr-commandWillStart . PlotSheetCount:Procedure)
)
) ;_ vlr-command-reactor
) ;_ setq
) ;_ or
;; update/set variable for reactor
(setq PlotSheetCount:Value (vl-princ-to-string (length (layoutlist))))
;; procedure
(defun PlotSheetCount:Procedure (#Call #Info)
(cond
((wcmatch (strcase (car #Info)) "*PLOT*,*PUBLISH*,*PREVIEW*,*REGEN*")
(setq PlotSheetCount:Value (vl-princ-to-string (length (layoutlist))))
)
) ;_ cond
) ;_ defun
As to the sheet number I use a diesel expression to extract it from the layout tab name which must be in the general form ???(#) [ex. SH (1) or WS (13)]. I use this general form because if you copy an existing layout the number in the parenthesis will be automatically incremented to the next number.
The diesel expression is:
$(substr,$(getvar,ctab),5,$(-,$(strlen,$(getvar,ctab)),5))
the number 5 in the expression is the position of the first numeric character in the layout name, so if you want to name your sheets S (#) then the 5 would be a 4 [note there is a space between the S and the (] or if you like Sheet (#), the 5 would be an 8.
All of that being said unfortunately the OEM version of autocad does not support LISP. 🙁
The emoticons embedded in your code really dress it up. I'm more of a traditionalist in this regard, and leave the smileys out.
Jim Frame, post: 409959, member: 10 wrote: The emoticons embedded in your code really dress it up. I'm more of a traditionalist in this regard, and leave the smileys out.
I know right.... I checked, if you copy and paste them into notepad you get the right code back out.