AutoCAD Visual LISP / AutoLISP :: Retrieving Current Paper Text Height
Oct 10, 2012I'm looking for code to retrieve the "Paper Text Height" from the current (active) "Text Style".
View 7 RepliesI'm looking for code to retrieve the "Paper Text Height" from the current (active) "Text Style".
View 7 RepliesI am working on a simple function to add/remove a non-printing stamp our drawings to specify a preliminary drawing. The issue is that I cannot seem to get AutoCAD to accept the text height in the Mtext command. Below is the code; try it and see.
(DEFUN NOT4CONSTRUCTION(/ CTR HGT PT1 PT2) (IF (EQ (GETVAR "CLAYER") "NOT4CONSTRUCTION") (SETVAR "CLAYER" "0")) (IF (EQ (GETVAR "CTAB") "MODEL") (SETQ HGT "8'-4"") (SETQ HGT "1"")) (IF (= (ASSOC 0 (TBLSEARCH "layer" "NOT4CONSTRUCTION")) nil) (PROGN (VL-CMDF "-LAYER" "M" "NOT4CONSTRUCTION" "C" "30" "" "TR" 90 "" "P" "N" "" "") (SETQ PT1(LIST (- (CAR (GETVAR "viewctr")) (/ (* (GETVAR "viewsize") (/ (CAR (GETVAR.
[code]....
How to change the dim text color in current dimstyle with a lisp routine? I want to modify current dimstyle instead of override current dimstyle, so it can change all existing dim text color under the current dimstyle.
View 9 Replies View RelatedHow can i build a selection set of all circles and then retrieve the xdata attached to them?
View 9 Replies View RelatedTried retrieving an ActiveX selection set in AutoCAD 2013 (AutoCAD Architecture 64bit on Windows 7 is what I am using)?
Using a piece of LISP I got from the ADN developer site, it no longer works and gives this error....
Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended.
(defun c:erset (/ acApp acDoc selSets ss1)
(vl-load-com)
(setq acApp (vlax-get-acad-object))
(setq acDoc (vla-get-activeDocument acApp))
(setq selSets (vla-get-SelectionSets acDoc))
[code].....
Unfortunately my lisp is very basic.
(defun c:getSset()
(vl-load-com)
(setq ss-vba (vla-item
(vla-get-selectionsets
(vla-get-activedocument
[code]......
What about creating an AutoLisp selection set from .NET - is it possible, if so I would prefer to do that instead?
The goal is to create some objects in .NET (using activeX or managed code) and then have some way to access these objects via the command line I'm assuming they only way is using an AutoLISP selection set.
I'm running the following string in a routing that is looping so I get dozens of these prompts. How to supress these? Or, do i have to use to entmake?
(begin loop...
(command ".-Mtext" CSW-Tpoint "W" 0.0 (vl-filename-base (vla-get-imagefile image)) "")
);end loop
Prints to the command line..
Current text style: "Standard" Text height: 0.0833 Annotative: No
Current text style: "Standard" Text height: 0.0833 Annotative: No
Current text style: "Standard" Text height: 0.0833 Annotative: No
Current text style: "Standard" Text height: 0.0833 Annotative: No
how can i know if the current view/display is align with the current ucs?
let's say i have rotate the ucs about z axis 45 degrees and make it plan now i draw some things and then i change back to world
worlducs = 1
viewdir = 0,0,1
ucsxdir = 1,0,0
ucsydir = 0,1,0
but the display is still in the ucs z 45 (ucsfollow = 0) set the view to PLAN current (now the view is aligned) but the system vars does not change.
For a plan UCS, you would need to compare the VIEWDIR system variable and the cross product of the UCSXDIR and UCSYDIR system varaibles.
[URL]
Technique that can check the current plotter name for the current tab and assign it to a variable? i.e. can it be assigned to a variable to check if if equals "myplotter1". The next step - is there a technique to change the plotter name to "myplotter2.pc3".
I have partially done the latter part of this in the past using the -plot command line to ASSIGN a new plotter but I would really like to only run the routine if it really needs to.
presuming I have a selection set of different entities, that might have different linewight.
The code that is responsible for this property is 370
370Lineweight enum value. Stored and moved around as a 16-bit integer.not omitted from here
I need to make all of the entities have the same layer, and to make sure the each entity has the "ByLayer" lineweight.
The problem that I encountered, is the lineweight changement.
This is the colution that I came with, but it doesn't work for me:
(defun c:test () (setq en (car (entsel))) (setq el (entget en)) (setq el1 '()) (setq indx -1) (repeat (length el) (setq indx (1+ indx)) (if (/= (nth indx el) (assoc 370 el)) (setq el1 (cons (nth indx el) el1)) ) ) (setq el el1) (entmod el) (princ) )
Having tested it in different ways, it looks like at the end, el1 represents the association list that I want my object to have, but it doesn't want to update.
I am modifying stuff in a dynamic block insert entity. There is no "endblk" entity at the end of these definitions and I need to cycle through every entity within the block definition. When it gets to the last entity, I get an error because you cannot entnext passed the last entity. There are 2 things:
1. How to retrieve the # of entities in a block without cycling through it.
Or
2. A quick lesson in the *error* function, I cannot figure out how to implement this. I basically want to to say:
(if (entnext myent)) returns a error, don't abort & continue on.
When dynamic blocks are inserted they're assigned an anonymous block name. I'd like to be able to retrieve the name of the parent block after selecting the block on screen using AutoLisp.
Need a bit of code that handles this?
I have this lisp which will display the height of a 3D object to 2 dps. What I need is for 3dps to be displayed but I have no real understanding of LISP coidng so I can't work out where this is specified in the routine.
Why this LISP does not work when I try to use it in a drawing which has a Pointools POD file working (or previously had one) within it?
Where is this data stored?
Geo Location
Sun Source vector (I can see it in the "Sun & Location" Panel)
But how use this data.
In attachment you will see sample drawing with all this information.
How can I find them with lisp?
Tables do no have a rotation angle. I can find the insert point, but there is no other point to make an angle calculation with.
(setq objTable (vlax-ename->vla-object (car (entsel))))
(vlax-dump-object objTable T)
The first rectangle is drawn from 0,0 at the World Coordinate System. There is never any trouble with the code below when the objects are drawn at the WCS. The problem is when I try to draw a bounding box around an object while in another UCS. It seems that it always draws the bounding box at the WCS instead of my UCS. I have used (trans <pointlist> 0 1) on all combinations it seems and I still cannot get it to draw the bounding box at the current UCS.
(defun c:GetFromBoundingBox (
/
*ACAD_DOCUMENT*
mspace
pSelectedObject
lwLeft
upLeft
lwRight
upRight
[code]...
I'm trying to set up a height label for sections and elevations. I then want to update it with a shortcut.
I already tried it with a field that shows me the y coordinates, but it won't show me the "+-"0.00 sign,when I put it to zero level. It only writes "0.00".
I design a small plant in Autocad 2012. For the pipes we used cylinders and boxes(for square pipe), now we need to make the bill of materials, but I don't know how to extract the data from each cylinder(radius and height) or box.
It is possible to do this?
I place a small sample from the plant. Totally I am having around 6000 elements.
Which registry Key stores the name of the Current profile ("cprofile")?
I tried following, all reurn 'nil'
(vl-registry-read "HKEY_CURRENT_USER\Software\Autodesk\AutoCADR18.1\ACAD-9005:409\Profiles")
(vl-registry-read
"HKEY_CURRENT_USER\Software\Autodesk\AutoCADR18.1\ACAD-9005:409\Profiles\(default)")
In the registry when I double-click the key, the value is displayed. But I can't access it.
i have a for example a block with one attribute and would like add a new attribute. i´m trying to read the current block and redefine - it comes a new attribute in propertieswindow but not graphical.
(defun c:ent () (setq bn (getstring "
give a block name ")) (setq bez (getstring "
give a attribut name ")) (entmake (list (cons 0 "BLOCK")(list 10 0 0 0)(cons 2 bn)(cons 70 2))) (setq fe (entmakex (list (cons 0 "CIRCLE") (cons 8 "0") (cons 10 '(0 0 0)) (cons 40 1)))) (entmake (list (cons 0 "ATTDEF") (cons 8 "0") (cons 10 '(0 0 0)) (cons 11 '(0 0 0)) (cons 40 1) (cons 1 bez) (cons 3 "TOP") (cons 2 "NAME") (cons 70 0) (cons 73 0) (cons 50 0) (cons 41 1) (cons 51 0) (cons 7 "STANDARD") (cons 71 0) (cons 72 0) (cons 210 (list 0 0 1)) (cons 74 0) (cons 62 256) (cons 39 0) (cons 6 "BYLAYER"))) (entmake (list (cons 0 "ENDBLK")(cons 8 "0"))) (entdel fe) (entmake (list (cons 0 "INSERT")(cons 2 bn)(cons 10 '(0 0 0))(cons 66 1) (cons 62 256) (cons 39 0) (cons 6 "BYLAYER"))) (entmake (list (cons 0
[code]....
I am trying to create a custom message box with variable width and height by passing width height title and list of text. I can get the routine to work if I use preset width and height, but would like to make the box adjustable.
Here is what I have so far -
;--dialog box--
MYmessage :dialog{
label="Custom message box";
:column {
:text {
key="MY_message_Title";
fixed_width_font=true;
[code].......
I have the below code (from a user here on the forum) which works great for aligning text, mtext and blocks to 2 points. For annotative entities, it respects the rotation angle for mtext and text.
ie I have an mtext object at 1"=20' scale and at 1"=40' scale. I run the command when the current annotative scale is 1"=40'. The object at 40' scale has changed, but the 20' scale is unchanged. This is working as I would like it to.
But for annotative blocks, it gets weirded out. In the above example, the block at 40' will rotate, but so will the attributes at 20' scale. But linework and hatching at 20' scale will be unchanged. it looks really weird. how to get it to play nice with blocks. Ideally, I'd like the block to be at different rotation angles in different annotative scales.
(defun C:R2P (/ ss ang edata); = Rotate objects to align with 2 Points (setq ss (ssget '((0 . "*TEXT,INSERT"))) ang (angle (getpoint "
First alignment point: ") (getpoint "
Second alignment point: ")) ) (repeat (sslength ss) (setq edata (entget (ssname ss 0))) (entmod (subst (cons 50 ang) (assoc 50 edata) edata)) (ssdel (ssname ss 0) ss) ))
I am looking for an example excel macro to zoom to an object given the obect entities handle.
View 2 Replies View RelatedHow to create lisp which i can simply type in to the command bar so that the current drawing's filepath-folder will be automatically opened by windows explorer?
running AutoCAD 2012 / Windows 7...
I have a problem with "tools/window attributes/configure current"when I try to configure current window (especialy tabulator spaces 8 -> 2) I got fatal error: unhandled access violation Writing 0x0000 Exception at cc424946h
Windows 7 (x64)
AutoCAD 2009, 2010, 2011, 2012
standalone instalation
user with administrator privileges
We are using this code for Page setup. But We don,t know how to make this page setup current and active.
(defun c:pgs ()(acet-error-init(list(list"cmdecho"0"osmode" 0)T))(vl-load-com)(setvar "Tilemode" 0)(vla-Add (vla-get-PlotConfigurations (vla-get-ActiveDocument (vlax-get-acad-object))) "A1" :vlax-false)(vla-put-PageSetupOverridesTemplateFile (vla-get-files (vla-get-preferences (vlax-get-acad-object))) "A1")(setq item (vla-Item (vla-get-PlotConfigurations (vla-get-ActiveDocument
[code]........
cannoscale applies the current annoscale to all objecs...i would like to apply it to specific objects?
View 6 Replies View RelatedI only do programming when absolutely needed so it usually only happens every couple years. I wrote this routine to count nested blocks inside of dynamic blocks to count parking spaces. The routine worked fine but was relying on the ltscale to scale a block containing an attribute for the total number of spaces. I want to update the routine to use an annotative block so the scale doesn't have to be set. I changed my block containing the attribute but now when I run my routine, the attribute height gets changed each time the routine is run. The text just gets larger and larger. Here is the portion of the routine where the attribute info is gathered and updated with the new value for that attribute. If you need the entire routine, I can post it with a slight modification so it will work outside our network.
(defun updateattrib ()
(setq CNT 0) ; sets count to 0
(while (< CNT (sslength ss)) ; starts loop while CNT is less than the number of objects in the group
[Code].....
I am running this in Civil 3D 2010 but will want it to work in 2013 so if the solution will only work in 2013, that is fine with me.
How can I get/edit the properties (height,..) of a drawing view created with 'viewsection' command?
View 2 Replies View RelatedI need to count the blocks in paper space automatically. Is there any method or lisp for this.
View 7 Replies View RelatedRoutine to build a legend in paper space
I am looking for a routine or app to pull existing MS legend symbols (inserted from the block library) from the drawing and automatically place them in a PS legend. Since I don't have a large screen and sometimes miss a symbol before running a test plot, I wish to automate the process.
I am looking for a way to populate a paper space legend with blocks inserted into the drawing for Land Desktop 2005, 2006 drawings.
I also have to replace non-conforming architectural blocks with my own, then build the legend from all drawings tabbed in the drawing file (possibly all xref drawings as well).
I liked your article on 'Selectively writing drawing blocks to any folder using VBA'. I need to brush up on my VBA 6.0 and learn VB.NET. Perhaps your code can be modified to do the task, and this would be useful to many other designers in a further article.
Is there a way by which I can link a paper space block attribute to model space block attribute
In other words
Paper space as a block Title and attribute "QTY"
Model space has a block X and attribute "QTY_MODEL"
Is it possible to edit "QTY" and as a result get automatic update on "QTY_MODEL"
I am not familiar with diesel/macros yet in Acad.
Config :: Intel (R) Xeon (R) CPU E31245 @ 3.30 GHz, 16.0 GB, 64bit win7
Inventor 2013 and Vault Basic 2013