AutoCAD Visual LISP / AutoLISP :: Set Z Axis Orientation To Two User Points To Draw And Extrude Circle
Feb 10, 2012
I'm trying to change a routine i just wrote that draws 3d pipes. I wanted to make it so that when a user selects the beginning point and ending point of the pipe, the LISP changes the ucs to that vector, draws the circle at the beginning point and extrudes it to the second point.
It actually works great except when the ucs changes, so do my user points because of teh origin change. Is there a better way I might get this to do what I wnat it to?
(setq ip (getpoint "
Pick First Point:"))(setq ep (getpoint "
Pick Second Point:"))(command ".ucs" "za" ip ep)(setvar "osmode" 0)(command ".circle" ip "d" od)(command ".extrude" (entlast) "" (distance ip ep))(command ".ucs" "w")(setvar "osmode" oldsnap))
View 2 Replies
ADVERTISEMENT
Jul 13, 2013
I'm trying to create a model of arrow with which I could place in drawing in any length and orientation I want with lisp. I was imaging to place two point on this arrow and by placing the two points on my drawing, the length and orientation of the arrow would be define.
I'm trying for hours to create it and my grip for polar stretching don't stay still on my arrow (suppose to be on the peak but go far if I stretch it).
View 9 Replies
View Related
Jul 23, 2004
Routine that will draw a insulation hatch around a circle?
View 9 Replies
View Related
Oct 21, 2013
Can a AutoLISP command be written to read an attribute in a block and draw a circle with the attribute as the diameter using variables? The appilcation is taking the diameter of a tree trunk (the attribute), multipling by 12, and drawing the canopy circle on hundreds of those blocks. So the circles drawn will vary in size.
Not sure how this could be set up, i'm not familiar with LISP writing at all.
1) Read block, single, mulitple or definition?
2) Read Attribute
3) Varaible of attribute, (attribute is an inch measurement...it needs to be multipled by 12 to get feet for final use as circle diameter drawn)
4) Draw circle, variable, with diameter coming from attribute variable (attribute in inches that is multipled by 12)
5) Center point or circle to be block's base point
View 9 Replies
View Related
Jul 7, 2012
I have a list with many points is it possible that i can draw a line or polyline on those points using MapCar function.
View 6 Replies
View Related
Sep 16, 2013
I have a list function that asks for the user to pick points when it is run. It looks something like this (foo arg1 arg2) When invoked it asks the user to pick points and press enter when done It.
Instead of getting the points from the user i want to pass it a list of pre-defined points. The code cannot be changed so I must use it as is.Is this possible, if so how can it be done?
View 9 Replies
View Related
Feb 6, 2012
I have to put some trusts between two beam. It sounds easy but i'm unable to handle the divide and round off commands in the lisp. See attachement also.
To draw my trust between the 2 beams, what I normally do, is that I manually take the distance between the two points say it's 10 000 and wrote it down. Then I divide it by my max gap, say 1200, it is the max space between trust.
10 000/1200 = 8.333333 that's the result of how much trust and space between them that i'll need, 8 trusts, 9 spaces between the 2 beams. (That is what I'm unable to do in the lisp, tell it to round off 8.333 to 9 and use 9 for divide command)
What I manually do at this point to draw these trust is that I must create a temporarly line between the 2 beams, perpendicularly to these and divide it by 9.
It gives me 8 cross (or point) to draw my trusts. All this is long to do manually because I have many bay in building and I have to redo this operation for every the bay.
So, what I would like the lisp to ask is:
Specify distance between two beams (Between where and where) :
Specify the lenght of the trust :
Specify max gap: I would like to answer a number here, say like 1200 max
(The lisp should draw the lines on the current layer, color and linetype of the current layer and not draw a line at the beginning and at the end because that's where my Beams are. I hoped you understand, see attachement.
Should also have something that handle a ESCAPE hit or cancel, something like this:
(defun trap1 (errmsg) (command "_.undo" "_end") ; undo end (setvar "osmode" oldsnap) ; restore variables (setvar "cmdecho" 1) ; enable cmdecho (setq *error* temperr) ; restore old error handler (prompt "
[Code] ....
View 4 Replies
View Related
Aug 6, 2013
How to distribute object (circle) in selection of great number of points?
View 5 Replies
View Related
Jan 1, 2014
I am trying to extrude an object in the negative Z direction.
Easy to do at the command line by putting a "-" sign before the distance to extrude the object but I'm having trouble in autolisp.
Define points for polyline for valence
(setq p1v p1)
(setq p2v (polar p1 (DTR 0.0) box_width))
(setq p3v (polar p2v (DTR 90.0) val_thick))
(setq p4v (polar p1V (DTR 90.0) val_thick))
;-- Create valence polyline
;-- Draw the polyline for the valence
(command "pline" p1v p2v p3v p4v "c")
;-- Assign the new part a variable name
(setq cab_valpl (entlast))
THIS IS THE PART I'M TRYING TO FIGURE OUT BELOW ....... WHAT IS THE SYNTAX TO EXTRUDE "VAL_HT" IN THE NEGATIVE DIRECTION?
;-- Extrude the polyline to make the valence
(command "extrude" cab_valpl "" val_ht "0")
View 6 Replies
View Related
Oct 14, 2013
I'm trying to get a lisp routine to flatten out ellipses, I have changing the z-coordinate to equal world ucs z ok , but can't seem to get it to re-align the normal axis zo it matches the world ucs axis.The code works fine for a circle and sould not be any different for an ellipse, yet it falls over at the (vla-put-normal) statement for the ellipse.Any clues, or is it a failure in implementation for ActiveX?
(defun FL_normal (mspace index / changeobj currNormal newNormal)
(setq changeobj (vla-item mspace index))
(setq newNormal (vlax-3d-point 0 0 1))
(setq currNormal (vlax-variant-value (vla-get-Normal changeObj)))
(alert
[code]...
View 5 Replies
View Related
Jul 3, 2012
I'm inserting blocks with lisp using the following code.
(defun C:test()(setq MYPOINT (getpoint "
Select an insertion point"));(command "_-xref" "attach" "C:/ICT/GEBERIT/XREFS/650-270-00-1.dwg" "_Scale" "1" MYPOINT)(command "insert" "C:/ICT/GEBERIT/XREFS/650-270-00-1.dwg" MYPOINT "" ""))
The lisp however only allows me to rotate in the x-y plane but I also want to rotate it in the z-axis hoe can I do this?
I also tryed to combine a 3d rotate to the code, as follows but to no success...
(defun C:test() (setq MYPOINT (getpoint "
Select an insertion point"));(command "_-xref" "attach" "C:/ICT/GEBERIT/XREFS/650-270-00-1.dwg" "_Scale" "1" MYPOINT)(command "insert" "C:/ICT/GEBERIT/XREFS/650-270-00-1.dwg" MYPOINT "" "");Rotates the item in the z axis...(setq MYANGLE (getstring "
Specify rotation angle for the Z-axis "))(command "_Rotate3D "_x" "LAST" "" "last" MYANGLE ))
View 3 Replies
View Related
Jul 31, 2012
I found a program which rotates selected block(s) about thier insertion point. I modified it to rotate each of the block(s) about the y-axis. Works great. Now, I would like to change it so that it rotates a copy of each block about the y-axis and leaves the origial block in place. Its kind of like the mirror command exept it is rotating the new block(s) to the other side instead of flipping them. I want to keep all or the parameters of the block(s) the same as each original. I am using AutoCAD 2010. MOCORO is not recognized as a command. The new features workshop says to use the new command AMCOPYRM, which is not recognized either. Go figure.
(defun RotateDuplication (/ CN ENT theObjects SS)
(vl-load-com)
(setq SS (ssget (list (cons 0 "INSERT"))))
(repeat (setq CN (sslength SS))
(setq CN (1- CN)
ENT (ssname SS CN)
[Code] ......
View 1 Replies
View Related
Sep 5, 2012
I just need the userinput to be incorporated in the insert command but don't know how to segregate the block name from the block path..
;;;PROMPT USER FOR BLOCK NAME HERE
(setq userinBLKNAME (getstring "
Please type in the block name shown in the allrevblocks - ex: IFCC4:"))
;;;INSERT BLOCK BASED ON BLOCK NAME PROVIDED HERE
(command "-insert" "B:\CAD\REVBLOCKS\IFC\"USERINBLKNAME PAUSE "1" "" "")
View 3 Replies
View Related
May 7, 2012
I've been trying to append a user input by adding this text "ABC" to the front of it. How can I do that?
(setq NUMX (getstring "
Please specify NUMBER:")); INPUT NUMBER 123 HERE
(SETQ NUMXX (append '(ABC) NUMX))
So that NUMXX now equals ABC123.
View 2 Replies
View Related
Dec 17, 2012
Any way to permanently disable polar. Like if autocad were to automatically switch to ortho every 10 mins or something?
View 5 Replies
View Related
Apr 25, 2012
I have a little LISP I have been working on that creates a text object as a "label" for 2D ductwork our company does. It makes a field for the mlinescale as the duct width, combines with user input for duct depth, and prompts user for location to place the text. The routine is functional...however, I would like to tweak two things that I cannot figure out.
First, I would like the command to continue until the user escapes, similar to the "multiple" command in AutoCAD. I have tried adding a while loop to the majority of the routine..which works until the user escapes...then my error handler undoes everything.
Second, when asking for user input, is it possible to ask for user input without a default the first time, but thereafter remember the input as a default?
Below is the code in question...not including error handler, etc. :
(if (= ducttemp nil)(setq ducttemp 12))
(initget 6)
(setq ductdepth (getint (strcat "
Enter duct depth in inches <" (itoa ducttemp) ">, or Esc to end: ")))
(if (= ductdepth nil) (setq ductdepth ducttemp) (setq ducttemp ductdepth))
[Code] .........
View 4 Replies
View Related
Dec 14, 2013
I want to write a very simple AutoLISP program to scale selected objects by a factor of (1/25.4). How to I get the program to pause and allow the user to select the base point? I know that "~" will bring up a selection window, but what is the character that will allow point selection (in this context)? While we're at it, what is the operator that would trigger a pause and allow user command line input?
View 7 Replies
View Related
May 16, 2012
I'm trying to combine two user inputs and a constant with setq without spaces so I can use it in an AutoCAD command.
I haven't seen a string command that does this. It always has spaces in between the fetched valvues.
View 9 Replies
View Related
Jul 16, 2013
I have a routine that sets user defined osnaps based on a text file.Here is what is an example of user stored osnap settings -
(setq User_Osnaps (list (list "Alan" "endp,midp,int") (list "John" "cen,ins")))
Here is routine I use to set user osnaps -
(defun CU ()
(vl-cmdf "-OSNAP" (cdr (assoc (getvar "LOGINNAME") User_Osnaps)))
(princ)
)
This works great so long as the user is not in the middle of another lisp routine.How can I change this to a transparent command that will work to set osnaps while running another lisp routine?I would like to store it in a toolbar button.
View 9 Replies
View Related
Sep 13, 2011
I need a command that will allow the user to select a layout tab. I thought the following would work, but it just ends the LISP program:
(command "layout" "s" pause)
View 9 Replies
View Related
Jul 30, 2012
Is there a way to have an alert box pop up at a certain point in the code which gives the user a chance to cancel the LISP program and not proceed any further?
View 9 Replies
View Related
Oct 25, 2011
I am looking for a way where a user is prompted to select a row of blocks and then that row is completely mirrored about the middle of the selection set - such that if the blocks are originally inserted, from left to right "A" "B" C" then after mirroring, we want them t occupy (roughly) the same space in the drawing area as "C" "B" "A".
Then, immediately after mirroring that selection set in place, each individual block that makes up the selection set is mirrored about its insertion point along the x axis..... basically i need to mirror a selection set of a row of blocks so I change their order of occurrence and then mirror each individual block back again to the way it is meant to look.
Is this possible?
View 9 Replies
View Related
Sep 2, 2013
how can you get the last point you picked on a Circle because I was going to run the TTR and use the tanget command and have it exit and I need to get the point I pick on the circle
View 7 Replies
View Related
Dec 12, 2002
I was looking for a post on the subject of line and circle intersections and found one that Bill Z had posted. I decided to incorperate one of the replies into my own code. In particular Luis Esquivel's code. With some minor modifications I was able to add the onseg argument that extends intersection points for the line to the circle. I also modified it to return only one point or two points depending on the line and circle supplied and the onseg argument. It seems to work great.
; test function
(defun c:go ( / )
(ed_init)
(while
(or
(not (setq ent (entsel "
[code].....
View 9 Replies
View Related
Jan 5, 2012
I have a drawing that has 2D pipeline (only x and y, z value =0) and 3 topo contour lines ( with x, y and z vaules). I need to divide the the 2D pipeline into say 2000 points and then get the corresponding z values from the topo contour lines. I think it can be done by interpolating between the z values for the two apparent intersection points of the 2D line and the contour lines, the x and y values will be the same for the points that falls between these two aparent intersections. Is there any lisp out there that can do that.
View 7 Replies
View Related
Dec 4, 2013
I have situation where a block is inserted in paperspace before a leader is to be added into modelspace. I need it to work like the "CHSPACE" command - it pauses and asks the user to activate a viewport before continuing.
How that pause until viewport is active is done?
View 7 Replies
View Related
Mar 1, 2012
Is there a way to determine the type of ACAD object that the user selected? I need to retrieve the value from either a dimension or text. The info could be in either format so the lisp routine needs to determine what was selected so the correct vla-get command is used.
Once I determine what the object is I can use an if statement to retrieve the value.
;user selects the object
(setq dimobj (vlax-ename->vla-object(car(entsel))))
;If ACAD object is a dimension do this.
(setq dimvalue (vla-get-textoverride dimobj))
;If ACAD object is text do this.
(setq dimvalue (vla-get-textstring dimobj))
View 4 Replies
View Related
Nov 8, 2011
I'm putting together a simple lisp routine to issue bound, purged drawings.
I have code that will do the binding & purging but need handling the saving.
This is my approach :
(1) ask the user to save the drawing using this line (command "_saveas" "" "~")
(2) run a subroutine that binds xrefs etc (this works ok)
(3) run the QSAVE command
Trouble is, if the user cancels or hits escape during the SAVEAS command the subroutine & QSAVE will still run, overwriting the current drawing. How do I handle this scenario? Or should my appoach be different?
View 9 Replies
View Related
Jun 5, 2013
We are using .cuix file which gives access to tools in custom .arx file in AutoCAD 2012/2013. We load the menu using the .bundle mechanism and the plug-in - using button from the menu. If the user is Administrator (or executes AutoCAD as Administrator) the menu, toolbars and ribbons are loaded correctly and the user can load and unload the application (lisp function in .mnl file is used for that), but if the user is not an administrator either the menu, toolbars and ribbons are not correctly loaded or they are loaded, but the user can not load the application.
We have found that a probable cause for this behaviour is that AutoCAD tries to create/renew the .mnr file when first loading a .cuix file and since the user has no administrator rights this can't be done in the "C:Program FilesAutodeskApplicationPlugins" folder where the bundle is and AutoCAD creates the .mnr file in its own support folder ("C:Users<User>AppDataRoamingAutodeskAutoCAD 2012R18.2...Support") together with a copy of the .cuix file and changes the path for loading the .cuix file to this location. Since the .mnl file containing the function for loading/unloading is not copied with the .cuix file the application can not be loaded.
The user has to delete the created files under the support path of AutoCAD, unload the .cuix file and then reload it from the correct location to resolve the problem. Restarting AutoCAD leads to the same problem.
Is there a way to prevent this behavior other then running AutoCAD as administrator (that is not always an option)?
View 3 Replies
View Related
Sep 23, 2013
I am trying to locate a .wdp file with minimal user input. this is what I have so far
;All file saved in this folder
(setq filedir "I://PROJECTS//")
;User will put the following in, but there might be a small description after 915-01. That is why I have a wildcard
(setq filename (strcat "915-01*"))
; string together everything
(setq nextlevel (strcat filedir "JOB " filename "*" "//ACAD"))
;; the final path should look something like this:
I://Projects// JOB 915-01(something here... could be anything or nothing)//ACAD//915-01(something else could be here as well).wdp
;set file extension
(setq fileext ".wdp")
; search files
(setq wdp_file (vl-directory-files nextlevel (strcat filename "*" fileext)))
I am confused on where and when I can use wildcards for searching directories.
View 1 Replies
View Related
May 17, 2013
How do you detect the intersection of a line and circle or arc.
View 1 Replies
View Related