AutoCAD Visual LISP / AutoLISP :: Additional Counter For Layer Dimension
Aug 22, 2011if my attach lisp can add sort of counter that how many dimensions, leader and multileaders have been move to layer "dimension"...
View 9 Repliesif my attach lisp can add sort of counter that how many dimensions, leader and multileaders have been move to layer "dimension"...
View 9 Repliesi have this LISP as attach...at moment it works like this as below:-
1) Activate the LISP
2) Automatic select all the preset block name in the lisp and change to a pre-set layer
3) LISP end
Now i wish it to be like this:-
1) Activate the LISP
2) Automatic select all the preset block name in the lisp and change to a pre-set layer
3) At command prompt, will state out " n block have been change to layer Eye Bolt"
4) LISP end
As a consultant we grey out architectural backgrounds for our sheets. We use the SetByLayer command to change the color of the objects in our sheets to gery out. The issue is with dimsensions. Dimension Line Color, Extension Line Color, and Text Color are all set at By Block as default and no one ever bothers to change it unless they are setting it to a specific color which is even more of a problem for us. You can edit the properties of an existing dimension and set Dim Line Color, Ext Line Color, and Text Color to by layer, I am looking for a way to automate this. Something that can search through a drawing, grab all the dimensions (even in blocks) and set everything by layer.
View 9 Replies View RelatedI've been twigging around with a selectionset, but no luck. I need to build a ss with several named blocks and a few dynamic blocks which get selected as anonymous. Unfortunately not all dynamic blocks should be selected and I can find no way of either filtering out a list of dynamic blocks to exclude nor any way to campare to a list of dynamic blocks that I want selected. Below is the best idea that I had but if I wrap it into a foreach with an exclusion list, I get an empty selection set returned. (I'm guessing that I need to trim the pairs each iteration and only return the matches instead.)
(SETQ blklst (LIST "Cleaner" "DRAIN" "Return" "Therapy""PoolLight" "Paraleveler" "Waterleveler" "Skimmer" "UMSLEEVE") blst "Cleaner, DRAIN, Return, Therapy,PoolLight,Paraleveler,Waterleveler,Skimmer,UMSLEEVE")(IF (AND (SETQ ss (SSGET "x" (LIST '(0 . "INSERT") (CONS 2 (STRCAT "`*U*" blst)) '(410 . "Model")))) (FOREACH i blklst (MAPCAR '(LAMBDA (x)(IF (NOT (EQ i (VLA-GET-EFFECTIVENAME (VLAX-ENAME->VLA-OBJECT (CADR x)))))(SSDEL (CADR x) ss) ) ) (SSNAMEX ss)) ) ) (WHILE (SETQ Ent (SSNAME ss 0)) (SETQ BlkName (CDR (ASSOC 2 (ENTGET Ent)))) (IF(SETQ tempList (ASSOC BlkName EndList)) (SETQ EndList (SUBST (CONS BlkName (1+ (CDR tempList))) tempList EndList))(SETQ EndList (CONS (CONS BlkName 1) EndList)) ) (SSDEL Ent ss) ))
The other code is long and I'd rather not confuse things; if I do not try to filter out any Unames, then everything works great and fast. Once I add in the "foreach i blklst" the code breaks and I get:
; error: null interface pointer: #<VLA-OBJECT 0000000000000000>
returned.
I need to save an additional copy of a AutoCAD drawing whenever I press the save button.
Simply put, Every time I press save the autocad drawing is saved (Obviously!!!) but
I also need to save an exact copy of the drawing in a folder called (for eample only) "C:TestFolder"
I can do this using DxfOut for dxf files but I need to do this for dwg files.
Can it be done whenever I press the "save" button.
How to add the sheet description field into the rename & renumber window? I ask this because during the sheet set-up process we use the sheet description often, and I would like to go from sheet to sheet without having to right click and edit every sheet.
Civil 3D x64 2012
Win 7 x64 Ultimate
I7 3820 (3.6ghz quad core with HT)
32gig RAM (Corsair XMS3 4x8g)
Intel x z79 mobo (BOXDX79TO 2011 socket)
Radeon HD 7850 2gb GDDR5
How can i test a polyline if its clockwise or counterclockwise? I have a routine that gets the area of polylines then if clockwise,the area is positive and negative if not. But I dont want to get the area just to test if its clockwise or not.
View 9 Replies View RelatedIs there a lisp that will allow me to do a continuous dimension, but will alternate the dimension position from low, high, low and high? If there is no lisp already created, how to create one?
See Continuous dimension attachment for example.
I work at a glass and glazing company and this is how we dimension mullion width and DLO. See typical window dimensioning attachment for window elevation with dimensions.
I am wondering how I can override a dimension value through AutoLISP. Is there a command line that I can use so that the pop up window won't show up?
View 7 Replies View RelatedI want to override the measurement in a dimension with a string of text using a LISP command.
E.g.. "select dimension"
type new text for dimension
replace dimension measurement with new text. I can get the entity and its values, buy not sure which value to change for the "text override".
BTW Acad 2012.
how I would go about writing a function that would calculate the length of a diagonal of a rectangle using SQRT function? I've been trying but so far nothing!
View 4 Replies View RelatedI have the following code, that for some reason the last created dimension is no being selected. That's the first problem. The second (and not as improtant) problem( becasue it does work), is that I'm using the "dimedit" command. I prefer to do a swap within the dxf codes, that I treid but didn't work, so I resorted to the "dimedit" command.
(command "DIMLINEAR" pause pause pause)
(setq last_dim (entsel (entlast)))
(setq oldunits (getvar "lunits")) (setq oldprec (getvar "luprec"))
[Code].....
Is there any way to change the colors of the dimensions styles, including dimension lines, extension lines and text to "by layer"
I found a code to change the colors, but only affects the current dimensions in the drawing and the styles do not change.
I'm writing function which will facilitate user to offset dimension. After enter command, he select dimension and select point near one of dimension's arrowheads. Then I'm calculating new XLinePoint1 or XLinePoint2 and replacing original.
I have everything done. I thought ... The problem is when user firstly create AlignedDimension and after that he create RotatedDimension by using continous function. After that XLinePoint1 and XLinePoint2 are not parallel to the DimLinePoint (look at image).
How can I get coordinates of points selected in red rectangles?
I know that one is specified as "dimension line defining point" but what about second? How can I get its coordinates? Or maybe there is other way to get this point?
Looking to make a selection set of points that are on a specific layer, and then create a dimension between, in this case, two points. I feel like it should be very simple, but I can't get it to work for the life of me. Here is the test code I've been playing around with:
(defun c:test (/ sel1 TC)
(setq sel1 (ssget "X" '((8 . "VPOINTS"))))
(setq TC (polar (entget (assoc 10 (ssname sel1 0))) (dtr 180.0) 9))
(command "DIMLINEAR" (entget (assoc 10 (ssname sel1 0))) (entget (assoc 10 (ssname sel1 1))) "V" (polar TC (dtr 180.0) 9) "")
[code].......
I am trying to create a lisp routine, that will check the dimension style "standard" to see if its annotative. If it is, I need it to turn annotative to off.
ITO - Application Management
Factory Design Suite Ultimate 2012
AutoCAD 2012 | Inventor Professional 2012 | Vault Professional 2012
I there any way to set the dimension break size in autolisp ?
View 1 Replies View RelatedMy goal is to be able to select a line and a dimension and then have the line's length appear as the text override for the dimension. I have the code to substitute the variable "dist" for the dimension text:
(setq dimselected (entsel "
Select Dimension:"))
(setq newlength dist)
(command "dimedit" "n" newlength dimselected "")
but am having problems extracting the line's length to the variable and setting setting it equal to the variable. To make things more interesting, the value needs to be in inches with fractional inches accurate to 1/16".
I'm dimensioning an old drawing with the real (measured) dimensions and with the drawing dimensions in brackets (using ' 1500 (<>)' to give '1500 (1505)' for example.
What I'd like is to also be able to put on the difference between the length I type in and the length in brackets - as this would let me see any really glaring errors that can't be attributed to user-error on the laser measure.So I could type in '1500 (<>) (X)' where X is the formula, and get ' 1500 (1505) (5)' back?
How to be able to run a script that could highlight any dimensions where the number is brackets and the typed number have a a difference of, say, 50.Or failing that, any way to extract all the dimension text at the end into excel so I can see the differences myself?
Found this routine online and am hoping to modify it to my needs, just not sure how to proceed.
It exports the text out of the dims into an excel file, the issue I have is that it automatically opens a new book every time you run the lisp with the original workbook open.
I am trying to get it to automatically insert the next set of numbers on the row below the first pull.
Currently, when I do drawings, I give my machinists drawings with each point, and they program their machines. To do that, they calculate the round part diameters, which is basically 5" - 2x<Dim>.
I'd like it if I could give them drawings with the real number, and in parenthesis next to it, 5-2x<Dim>.
I've attached a jpg of what I normally give them and how I'd like it to look. Is this something do-able via a macro or something?
Is there a command or a lisp that will automatically dimension each side of a closed polyline at once? See attachment for image.
View 1 Replies View RelatedHow to write an AUTOLisp program to label building dimensions. With Civil3d 2013 preventing me from labeling multiple lines at once, creating building labels to dimension complex building exteriors is much more complicated than it needs to be. Lisp Routine that Generates a MText or Dtext dimension centered on a line and offset to be clear of the line. the layer for this piece of text would always be "DIMS-BLDG" and the text style will always be "L50s."
the text doesn't have to be organized as it is in this example. the main focus is the layer being correct with the foot mark, precision set to xx.x and oriented to the line.
Sometimes someone dimensions a floor plan and starts one direction and then "goes back " the other way over the top of the dimension they just placed, which causes the dimension lines to overlap, which in turn shows incorrect distances when viewing on paper. Any lisp routine that can alert you to the fact that there are overlapping dimension lines (not the extension lines) in a drawing by changing them to color White or something? I have pasted a routine that we use which changes all dimenions with "modified text" to color white. That way I can see if someone just typed in the dimension distance they wanted instead of what was actually there.
(defun c:dc (/ dim_length)
(setq ssmod (ssget "X" (list (cons 0 "Dimension")(cons 1 "~"))))
(if ssmod
(progn
(setq dim_length (sslength ssmod))
(command "Change" ssmod "" "P" "C" "w" "")
[Code] ......
I want to doubleclick on a dimension and have the DIMRND override appear
I can't figure out what command I need to customize the doublclick CUI
I wrote the code below (allow the user to pick points in different viewports and then override an existing dimension's text with the difference in X values. The (hopefully) last issue is that the fractions should be vertically stacked and at 100% text size.
(defun c2text ()
(command "mspace")
(setq p1 (getpoint "Select left point "))
[Code]....
I would like to set dimension text fill color to "background" instead of, you know, dimensioning my drawings properly.
I have this code I got on these forums and it works well except for the 'TextFillColor' variable. I can't find the correct color number or syntax for "Background'. It's currently set to 0 which produces ByBlock, and any number I put in there corresponds to the AutoCAD color number (1 = Red, 2 = Yellow, etc.)
If you have a better routine that you could post that works for me too. Or maybe you could just do my work for me? Even better.
(defun c:test (/ obj num cnt)
(vl-load-com)
(setq ss1 (ssget '((0 . "Dimension")))
num (sslength ss1)
cnt 0)
[Code]...
lisp..It work fine but just that i need some minor modificatio to it...At moment, when i activate the lisp, it will automatic select all dimension,leader and multileader to a layer call "DIMENSION"...Anyway i wonder if it is possible to prevent any dimension,leader or multileader in layer "Section" will not be change to layer "Dimension"?
View 2 Replies View RelatedSay I have 2 items, one is on layer "M-Duct" and the other on "M-Pipe" (they are in the same drawing). Any lisp routine that would create the layers "M-Duct-New" and "M-Pipe-New" (based on the same color and LT as the original layers) and then move those objects to the newly created layers?
View 9 Replies View RelatedPossible to link an xref layer and local layer so they display the same (eg. sync viewport colour, linewieght, line type)?
I insert xref's for my base drawing but legend is on local layers and I would like to be able to ensure that the line colour and linetype always match...
I have a customized button to draw an ‘ac-arrow’. I created a lisp to create the layer “G-ANNO-LEDR”
if the layer name is not found. The advanced part I would like is:
Current layer: E-ANNO-WIRE
Ac-Arrow Leader: G-ANNO-LEDR
OPTION 1:
If, say I am on current layer “E-ANNO-WIRE” and need to draw my “ac-arrow” leader, and continue working
on the original layer “E-ANN-WIRE” (and have the leader be drawn [remain] on the layer “G-ANNO-WIRE”).
With this option, I have the block “ac-arrow” imbedded in my template drawing file to have the block at hand.
With this option, the layer “G-ANNO-LEDR” will be created IF it is not on the drawing.
OPTION 2:
- Currently be on layer “E-ANNO-WIRE”
- Bring in the block “ac-arrow” from my block library “L:AutoCADSymbols”
- Draw the “ac-arrow” leader which will be on layer “G-ANNO-LEDR” (this layer created IF it is not
on the current drawing).
- After the leader is drawn’
- Be put back to the layer I was, “E-ANNO-WIRE”, and continue working.
The OPTION 2 is what I would really like to have. A while back, I happen to see one like OPTION 2, but I cannot
find it anymore on the users groups. I have been searching for a while now.
Currently, I use the button in my customized toolbar (see image) and have to have the “ac-arrow” block in my drawing and have its layer created in the drawing.