AutoCAD Visual LISP / AutoLISP :: Cannoscale Applies The Current Annoscale To All Objects
Mar 31, 2013cannoscale applies the current annoscale to all objecs...i would like to apply it to specific objects?
View 6 Repliescannoscale applies the current annoscale to all objecs...i would like to apply it to specific objects?
View 6 RepliesI am still green at lisp creation. I would like to create a lisp to change my cannoscale to match that of an existing dimension in model space. we use tabs and therefore have many different scales for the vports in our drawings. i want to be able to type my command, have acad ask for a annotative dimension to match, i click it, then the lisp resets my cannoscale to match.
View 4 Replies View RelatedI would like to be able to check if an Annotation Scale already exists and if it doesn't I would like to create it using the SCALELISTEDIT command and then set it to be the curent scale. I then plan to invoke the MLEADER command.
I do not want to have to rely on adding every possible scale in the list beforehand as my program would fall appart when a user decides to set an unusual scale I haven't thought of adding to the list.
See my initial start of the program.
(defun C:MLD ()
(command "cannoscale" "1:55") ;STOPS HERE WHEN 1:55 DOES NOT EXIST
(setq IfAnnoScaleExists (getvar "CANNOSCALE"))
(command "-scalelistedit" "add" "1:55" "1:55" "e")
)
The crux of the matter is that the CANNOSCALE value needs to match an existing named scale. This lisp is part of a bigger lisp and I need to pass a variable into it. Here's what I have:
(setvar "CANNOSCALE" (strcat "1" = " (rtos variable 2 0) "'"))
But I get this error when I try to run it.
; error: bad argument type: numberp: nil
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.
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]...
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 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...
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 RelatedI 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]........
I'm looking for code to retrieve the "Paper Text Height" from the current (active) "Text Style".
View 7 Replies View RelatedI'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 get the layer that an entity is on. I have tried numerous method but they don't seen to be retrieving the layer information.
View 8 Replies View Relatedhow to delete all OLE objects from drawing by most efficient way.
There are abt 150 drawings, each has from 2 to 20 or so OLE objects which need to be deleted. OLE objects are on many paper spaces.
I tried to use qselect but it selects only what is in current space.
Would need some lisp or some other methode than all can be deleted (excluding those which resides in blocks).
Tried also yto use ssx and then erase but still it deletes only what is on current space.
Just as additional info, those OLE are all pictures, not xls files for example.
I am trying to add a reactor, where if the object i move or copy is s a block of a certain name, then i would like to run update field on the last object (being copied) or the object being moved.
View 4 Replies View RelatedThe below adds a hyperlink to the selected object.How might it have to change to add multiple hyperlinks?
(entmod
(append (entget (car (entsel)))
(list
(list -3
(cons "PE_URL"
(list
(cons 1000 "..\..\90 Submittals\90-3 O&Ms\fig83-clevishanger.pdf") ; Relative Path to a pdf file.
(cons 1002 "{")
[code]...
I have been searching for some information on how to pass objects into a function so I can mess with their properties. Somehow I haven't been very successful. Anyway...What I want to do is take two items (light fixtures) and swap their positions on the drawing. It seems like it must be really simple, but I'm just not finding the key puzzle pieces to do it. It seems like if I could figure out how to pull two objects into the function (whether by selecting them and running the function or by selecting them after I run the function) I could very easily save the coordinates of one to variables and then just swap them.
View 9 Replies View RelatedHow to export to a txt file a list containg all the objects on the current layer and their properties?
To be precise, I would like to export the following items from a selection of plines:
- ObjectID;
- Start Point;
- End Point;
- Vertex Points;
- Width.
with a function like this I added some xdata, some MULTILEADER
(defun c:add_xdata () (princ "Select: ") (setq ogg (car (entsel))) (addXdata ogg "TEST" "CODICE" "1256") (addXdata ogg "TEST" "MATERIALE" "LEGNO") (addXdata ogg "TEST" "TIPO" "A"))
Now with the following function can only select leaders who have linked the xdata application TEST
(setq selez_all (ssget "X" '((0 . "MULTILEADER")(-3 ("TEST")))))
I can not, however, find a way to select all MULTILEADER who have a particular value of XData.
For example I would select all MULTILEADER with MATERIALE = "LEGNO" and TIPO = "A".
How to modify this routine so that I can select multiple objects as opposed to one at a time?
(Defun c:cd ()
(setq newdim (entsel "
Select Dimension to clear:"))
(setq newdimvalue " ")
(command "dimedit" "n" newdimvalue newdim "")
(princ)
)
I have a lisp I use to calculate the area of an object. The section below is the area part of it:
(setq ojt (entsel "Select object to get area of... "))
(command "area" "o" ojt)
(setq oarea (getvar "area"))
I want to modify it to add the areas of multiple objects. Unfortunately it is not as simple as;
(setq ojt (ssget "Select object to get area of... "))
(command "area" "a" "o" ojt)
(setq oarea (getvar "area"))
So how would I go about doing it?
is it possible select all ANNOTATIVE objects in a DWG and to set a Viewport/ANNO scale for all via lisp
View 3 Replies View RelatedI have made a lisp routine to draw lines on polyline. And here are a lot of lines on it. So using comand
"(command "line" pt1 pt2 " ")"
takes a lot of time. Is here a way to creat lines in memory or similar and only then draw them all on screen?
I have search but coudin't find any info. I do not know how to formulate a query.
I want to move a large 3D steel file on top of a 2D architectural background. The ISSUE is that when i move it (in plan view "aka top view") the X,Y coordinates change AND the Z coordinate changes... But, I want the Z coordinate to stay the same . I wrote a LISP file that doesnt seem to work (SEE BELOW):
(defun C:MoveXY (/ PT1 PTB PT2)(setvar "CMDECHO" 0)(setq PT1 (getpoint "
Specify Base Point or [Displacement] Displacement: ")PTB (getpoint "
Specify second point or <use first point as displacement>: ")PT2 (list (car PTB)(cadr PTB)(cddr PT1)))(command "_.MOVE" (SSGET) "" PT1 PT2))
It seems my issue comes when i get to the command line (ssget) seems to mess it all up . How to use the ".Move" command with the (ssget) function?