Leaderboard
Popular Content
Showing content with the highest reputation on 12/18/2024 in all areas
-
now you tell me I like this quote : “Life is not obliged to give us what we expect.” Sure , some users don't respond or don't give a like but unlike some users , I don't feel the need to respond to every thread or want to collect as many likes as I can for the sake of reputation points. Most of us are here just to give a helping hand to those who ask for it and expecting eternal glory or whatever only leads to disappointment. Having said this , I am gratefull for everybody who liked my post. It does give a feeling of appreciation. Even when OP is a No Show , others may still find your response useful. So when you do deal with a 'leacher' , just append his folder with "_No_Show" so next time you feel the urge to respond you can lower your expection for ever getting a response.2 points
-
Just wanted something more flexible , user friendly and sexier for me , myself and I2 points
-
A like... see what I did there....1 point
-
Try again... changing only "OldLayerName", ColourCodeNumber and "NewLayerName" - leave in the " " to indicate what is in the middle is a text string, and ColourCodeNumber is a value, 1-255 representing the index colour (5 ?, 256 I think is by-layer, 0 is by-block, I'd need to confirm that) (8 . "OldLayerName") -> (8 . "1 EXISTING TO RELO") for example. There are no checks that the new layer name exists in the above, if you want to go further with this - guided of course - we can add that check in For info, the (8 . .... ) 8 refers to the part of entity description, the dxf code we are searching for and after the dot (dotted pair list) is the value we want, here '8' refers to the layer the entity is on 62 refers to it's colour, change these and it will be looking for other things, 5 being the unique entity handle (so your search was for the entity named "1 Existing To Relo" AND also entity named ColourCodeNumber (which is not a valid number or variable, no " " means it is a number of variable ) Entity can't have 2 names at once either). Just so you know why it didn't work.1 point
-
This is a double post from the Autodesk Forums. I wonder if the OP has even looked back at this one with all the activity on the other post: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/looking-for-a-lisp-to-replace-a-block-with-another-version-of/td-p/132143051 point
-
@Ish Well - let's see what code you have tried to write, and we'll try to help you out. However, you should know by now that just demanding someone write code for you is considered extremely rude. With respect; we are not your free code writing employees.1 point
-
1 point
-
It seams to work for me... but you'll need to change the LISP to suit your own requirements. If you've changed the LISP to suit, post a copy of what you did below, probably something simple. Big-Als pop up box is a good solution if you have to do this many times with different layer and colour combinations... we can work you through building that up as well.1 point
-
Certainly! Here's a step-by-step guide to create a PythonScript macro in Notepad++ that reads a table of replacements from a CSV file and performs the replacements in the current document. Step 1: Install PythonScript Plugin Open Notepad++. Go to Plugins > Plugins Admin. Search for PythonScript and install it. Step 2: Create the PythonScript Go to Plugins > PythonScript > Show Console. In the console, click on the New Script button. Name your script, for example, ReplaceFromCSV.py. Step 3: Write the Script Copy and paste the following script into the editor: import csv import os from Npp import notepad, editor # Path to your CSV file csv_file_path = 'C:/path/to/your/replacements.csv' # Read the replacements from the CSV file replacements = {} with open(csv_file_path, mode='r') as file: reader = csv.reader(file) for row in reader: if len(row) == 2: replacements[row[0]] = row[1] # Get the current document text text = editor.getText() # Perform the replacements for old_word, new_word in replacements.items(): text = text.replace(old_word, new_word) # Set the modified text back to the editor editor.setText(text) notepad.messageBox("Replacements completed!", "Info") Step 4: Save and Run the Script Save the script. Open the document in Notepad++ where you want to perform the replacements. Go to Plugins > PythonScript > Scripts and select your script (ReplaceFromCSV.py). Step 5: Prepare Your CSV File Create a CSV file with two columns: the first column for the words to find and the second column for the words to replace them with. For example: old_word1,new_word1 old_word2,new_word2 Make sure to update the csv_file_path in the script to the correct path of your CSV file. This script will read the replacements from the CSV file and apply them to the current document in Notepad++.1 point
-
@Mohamed_Essam_2000 I asked you previously HERE, and I ask you again now: please post your questions in the forum. My profile is not your gear stick to make me work faster for you.1 point
-
(defun c:pp() (setq dist (getdist "red line length? ")) ;(setq dist 10) (setq d1 0.5) (setq line (car (entsel)) lst (entget line) a8 (assoc 8 lst) p1 (cdr (assoc 10 lst)) p2 (cdr (assoc 11 lst)) ) (entmake (list (cons 0 "LINE") (cons 10 (polar p1 (angle p1 p2) d1)) (cons 11 (polar p1 (angle p1 p2) (+ d1 dist))) a8 '(62 . 2))) (entmake (list (cons 0 "LINE") (cons 10 (polar p2 (angle p2 p1) d1)) (cons 11 (polar p2 (angle p2 p1) (+ d1 dist))) a8 '(62 . 1))) (entdel line) )1 point
-
So you want lines drawn 90 off the base line ? Still asking question how to select start point ? Distance along or mid ?1 point
-
1 point
-
Filter should be able to do this, select items on a layer and colour. As a learning exercise, look through the code, it is not working exactly as you want, some customisation required... which should be obvious. (defun c:relocate ( / MySS MyEnt ed acount) (setq MySS (ssget '((8 . "OldLayername")(62 . ColourCodeNumber)))) ;; Select items. Use ssget "_X" to select all. Change filters as needed (setq acount 0) ;; a counter (while (< acount (sslength MySS)) ;; a while loop (setq MyEnt (ssname MySS acount)) ;; nth position entity of selection set (setq ed (entget MyEnt)) ;; nth entity definition (setq ed (subst (cons 8 "NewLayername") (assoc 8 ed) ed )) ;; modify entity definition. User to change NewLayerName to suit (entmod ed) ;; update the entitiy with the new definition (setq acount (+ acount 1)) ;; counter + 1 ) ; end while ;; end while loop (princ) ;;exit silently ) ;end defun1 point
-
Hi @mhy3sx... I've updated my last posted code... Now it won't miss anything... I checked it and it worked well with fuzz = 1.0... HTH. Regards, M.R.1 point
-
1 point
-
OK, I see that @Dadgad gave me like... I'll post my revision... Here you are : (defun c:adj_lw1_lw2-new ( / vertlst unique lwupd lw1 lw2 enx1 enx fuzz vl1 vl2 bl par ) (or (not (vl-catch-all-error-p (vl-catch-all-apply (function vlax-get-acad-object) nil))) (vl-load-com)) (defun vertlst ( lw / enx ) (mapcar (function (lambda ( p ) (append (mapcar (function +) (list 0.0 0.0) (trans p lw 0)) (list (cdr (assoc 38 enx))) ) ) ) (mapcar (function cdr) (vl-remove-if (function (lambda ( x ) (/= (car x) 10) ) ) (setq enx (entget lw)) ) ) ) ) (defun unique ( lst fuzz / a ll ) (while (setq a (car lst)) (if (vl-some (function (lambda ( x ) (equal x a fuzz))) (cdr lst)) (setq ll (cons a ll) lst (vl-remove-if (function (lambda ( x ) (equal x a fuzz))) (cdr lst))) (setq ll (cons a ll) lst (cdr lst)) ) ) (reverse ll) ) (defun lwupd nil (setq enx (subst (cons 38 (caddar vl2)) (assoc 38 enx) enx)) (setq enx (subst (cons 90 (length vl2)) (assoc 90 enx) enx)) (setq enx (append (reverse (cdr (member (assoc 10 enx) (reverse enx)) ) ) (mapcar (function (lambda ( p ) (cons 10 (trans p 0 lw2)) ) ) vl2 ) (list (assoc 210 enx)) ) ) (entupd (cdr (assoc -1 (entmod enx)))) ) (if (and (setq lw1 (car (entsel "\nPick LWPOLYLINE you want as adjusting reference..."))) (= (cdr (assoc 0 (setq enx1 (entget lw1)))) "LWPOLYLINE") (vl-every (function (lambda ( x ) (= (cdr x) 0.0))) (vl-remove-if (function (lambda ( x ) (/= (car x) 42))) enx1)) (setq lw2 (car (entsel "\nPick LWPOLYLINE you want to adjust..."))) (= (cdr (assoc 0 (setq enx (entget lw2)))) "LWPOLYLINE") (vl-every (function (lambda ( x ) (= (cdr x) 0.0))) (vl-remove-if (function (lambda ( x ) (/= (car x) 42))) enx)) (princ "\nPick or specify fuzz distance <1.0> : ") (not (initget 6)) (setq fuzz (cond ( (getdist) ) ( 1.0 ))) ) (progn (setq vl1 (vertlst lw1)) (setq vl2 (vertlst lw2)) (setq vl2 (unique vl2 (* fuzz 0.5))) (foreach v1 vl1 (foreach v2 vl2 (if (<= (distance v1 v2) fuzz) (setq vl2 (mapcar (function (lambda ( x ) (if (equal x v2 (* fuzz 1e-12)) v1 x) ) ) vl2 ) ) ) ) ) (setq vl2 (unique vl2 (* fuzz 0.5))) (foreach v vl1 (if (and (not (vl-position v vl2)) (<= (distance v (vlax-curve-getclosestpointto lw2 v)) fuzz) (setq par (vlax-curve-getparamatpoint lw2 (vlax-curve-getclosestpointto lw2 v))) ) (setq vl2 (append (reverse (member (nth (fix par) vl2) (reverse vl2)) ) (list v) (member (nth (1+ (fix par)) vl2) vl2) ) ) ) ) ;| (mapcar (function (lambda ( a b c ) (if (equal (distance a c) (+ (distance a b) (distance b c)) (* fuzz 5e-5)) (setq bl (cons b bl)) ) ) ) vl2 (append (cdr vl2) (list (car vl2))) (append (cddr vl2) (list (car vl2) (cadr vl2))) ) (foreach b (unique bl (* fuzz 1e-12)) (setq vl2 (vl-remove b vl2)) ) |; (setq vl2 (unique vl2 (* fuzz 0.5))) (foreach v vl1 (lwupd) (if (and (not (vl-position v vl2)) (vl-some (function (lambda ( x ) (<= (distance x v) fuzz) ) ) vl2 ) (vl-some (function (lambda ( a b ) (equal (distance a b) (+ (distance a v) (distance v b)) (* fuzz 1e-3)) ) ) vl2 (append (cdr vl2) (list (car vl2))) ) (setq par (vlax-curve-getparamatpoint lw2 (vlax-curve-getclosestpointto lw2 v))) ) (setq vl2 (append (reverse (member (nth (fix par) vl2) (reverse vl2)) ) (list v) (member (nth (1+ (fix par)) vl2) vl2) ) ) ) ) (lwupd) ) (prompt "\nMissed or picked wrong entity type... You must pick LWPOLYLINE entities with only straight segments... Better luck next time...") ) (princ) ) HTH. M.R.1 point
-
Hi guys, As thanks for helping me out through the journey of AutoLISP from multiple posts, I've decided to make a small contribution to CADTutor.net with my own code that you can download from here: https://www.cadtutor.net/forum/files/file/27-block-overkill/ Upon issuing the BOVERKILL command, This LISP will allow you to either delete blocks that area "duplicated" on top of one another, or move them to a specified layer. This LISP deletes blocks in which the blocks in comparison abides to the following three criteria below: It shares the same insertion point to a specified tolerance It shares the same effective name It shares the same effective scale to the same specified tolerance Modes of Overkill Thanks to a wonderful suggestion from one of the insights in this forum, the program has been further upgraded as of 20 April 2023. This LISP routine now also allows for three modes of overkill: Distance Plane-Axis Axes The "Distance" mode is the default mode and is the most widely used mode of overkill. This mode determines that two blocks are considered duplicates if the distance between them is within the specified tolerance inputted by the user. The "Plane-Axis" mode determines that two blocks are duplicates if the proximity of the blocks in comparison lies within one tolerance specified for one of the planes , and a separate tolerance along the third axis (normal) of that plane. Calculations are done to the UCS. The "Axes" mode determines that two blocks are duplicates by comparing three different tolerances across each axis individually. All three tolerances must be met for the program to consider the blocks a duplicate. Just like the previous mode, the UCS will be used by the program to perform the calculations. Following this, the program will also draw a circle (of a radius set within the LISP routine) on the insertion points of the processed blocks. These circles will be drawn in the "BOVERKILL-Duplicates" layer. After which it prints a report of the quantity of the deleted or modified blocks to the command line. This feature makes it easy for users to identify where duplicates are found on a large drawing with thousands of blocks. However, the dynamic properties of the block are far too hard for me to calculate as they have different position, rotation and visibility parameters that could be altered by the user. As such, they are ignored. Note that the rotation of the block does not fall in the criteria above as mirroring the block alters it's rotation values, and thus will fail on some circumstances. This means that the blocks will still be processed if as long as the three criteria above satisfy and objects are not rotated the same way. This LISP was inspired when using block counting routines (for example from Lee Mac's Block Counter routine or your own custom routines) reporting incorrect numbers due to duplicate blocks. The OVERKILL command for one reason or another is not able to delete duplicate dynamic blocks that are (for example, rotated normally then rotate through dynamic rotation to the original position). I've also cycled through the net for solutions to no avail. Thus, I opened this program for you folks to use. It's not a perfect code but I hope it will make working for you much more convenient. Any feedbacks, comments, and criticisms are welcomed as I look to learn and get better. Enjoy. Thanks, Jonathan Handojo1 point
-
You can't modify the owner of the object reactor within the object reactor callback function for which that object is an owner. This would cause an infinite callback loop since the modification would fire the reactor, evaluating the callback function, triggering the reactor... However, there is a workaround if you want to modify the owner of an object reactor within its own callback function: disable the object reactor within the object reactor callback function and create a command reactor triggered by the commandended event. Then, within the callback function of the command reactor, modify the owner and re-enable the object reactor, then remove the command reactor. This is the method I use to retain the position of the centerlines in this program.1 point