CADEveryDay Posted October 9, 2023 Posted October 9, 2023 I am looking to create a routine that will: 1. Select an object in the drawing. (This will predominantly be a rectangle) 2. Take the name of the layer with the selected object (Veiwport_Outline_X) 3. Allow me to copy the object, move to new location, rotate and assign the name 'Veiwport_Outline_X' (X will look within the drawing to find the highest value at the end of the layer Veiwport_Outline_X and +1 to that layer) I have no idea where to start with this. Hats off to anyone who can come up with a solution. Quote
Steven P Posted October 9, 2023 Posted October 9, 2023 (edited) It is all on the internet. So what are your skills with making a LISP, if we give you tips. Select an object can be done using (entsel) function, something like: (setq MyEnt (car (entsel "Select Object"))) Where entsel will give you the point you clicked and the entity name in a list, car returns the first item in the list, the entity name. The entity description is made up of dotted pair lists, a descriptor and the value, generally the layer the entity is on is assoc list number 8. So you can get this with (setq MyLayer (cdr (assoc 8 (entget MyEnt)))) Where entget retrieves the dotted pairs lists, assoc 8 finds the one with value '8' and cdr returns the 2nd item of this list, the value or layer name. To copy in this case it might be easiest to use an AutoCAD command, something like this (command "copy" MyEnt "" pause pause) Where 'Command' tells the program that you are using a standard command, "copy" is the command name (this works with nearly all commands), MyEnt and "" are selecting the items and the pause pause is waiting for user input, the base point and copy to point. You could try the next line similarly with 'rotate' - run the command through the command line and note everything you do. Where you want a mouse input type pause otherwise enter the values you use. Work that part out, the next bits we can look at (entlast) and inserting a sub function to increment the layer name (evening here so CAD is off for the night, but that should be enough to get you started. Post what you make up and we can help with the next parts Edited October 9, 2023 by Steven P Quote
BIGAL Posted October 10, 2023 Posted October 10, 2023 Are you looking for this its step 1 of auto making layouts. Yes can rotate the rectangs. Draw rectangs.mp4 1 Quote
CADEveryDay Posted October 17, 2023 Author Posted October 17, 2023 On 10/10/2023 at 4:32 PM, BIGAL said: Are you looking for this its step 1 of auto making layouts. Yes can rotate the rectangs. Draw rectangs.mp4 1.41 MB · 0 downloads yes, this is what I'm looking for. Could you point me in the right direction? Quote
BIGAL Posted October 17, 2023 Posted October 17, 2023 Part 2 this follows a pline, then make layouts including the twist. PM me and we can talk about the program. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.