jim78b Posted April 22, 2020 Posted April 22, 2020 hello i have nanocad 11 and try to use my old autocad lisp files but they seem not work. what can i do? Quote
BIGAL Posted April 23, 2020 Posted April 23, 2020 When you say it does not work that's a bit broad statement, like Autocad Mac there is no VL so some lisps don't run. Need to test with simple lisp and work up to more complex, when Intellicad first came out had to do some minor recode on some lisps. Briscad Polygon works different to Autocad just a nuisance but solvable. Quote
jim78b Posted April 23, 2020 Author Posted April 23, 2020 .Oh i don't know this i thought that lisp work at 100.i wanted buy nanocad but this thing make me some doubt about it...is there not possibilità to run sone lisp code ? Quote
hanhphuc Posted April 23, 2020 Posted April 23, 2020 Try to debug manually, copy every line of code in command line princ the comment or check variable example (setq p (getpoint "\npick point")) (setq dist (getdist "\nNow get dist")) (princ "\nBegin polar ") (setq b (polar p ang dist)) (princ "after polar what happen?") (princ "etc...") if error occurs, check & see where the comment stops check variable !dist , !ang etc.. or just post your problem LISP file, perhaps others may help too p/s: and & progn Quote
jim78b Posted April 23, 2020 Author Posted April 23, 2020 (edited) Ok i don't know lisp programming..is better i post my lisp files How can i know the Syntax of nanocad lisp ? Edited April 23, 2020 by jim78b Quote
jim78b Posted April 23, 2020 Author Posted April 23, 2020 (defun C:RTC (/ gru) (setq gru (ssget)) (if gru (progn (command "_COPY" gru "" (list 0 0)(list 0 0)) (command "_ROTATE" "_P" "") (princ "\nBase point e primo punto d'angolo: ") (command pause "_R") (command (getvar "LASTPOINT")) (princ "\nSecondo punto d'angolo: ") (command pause) (princ "\nAngolo finale: ") (command pause) ) ) (princ) ) HELLO I WRITE A LISP THAT DON'T work, if possible i want insert the number of copies i want when rotate thanks in advance Quote
maratovich Posted April 23, 2020 Posted April 23, 2020 49 minutes ago, jim78b said: (defun C:RTC (/ gru) (setq gru (ssget)) (if gru (progn (command "_COPY" gru "" (list 0 0)(list 0 0)) (command "_ROTATE" "_P" "") (princ "\nBase point e primo punto d'angolo: ") (command pause "_R") (command (getvar "LASTPOINT")) (princ "\nSecondo punto d'angolo: ") (command pause) (princ "\nAngolo finale: ") (command pause) ) ) (princ) ) HELLO I WRITE A LISP THAT DON'T work, if possible i want insert the number of copies i want when rotate thanks in advance What is your version of NanoCAD?I checked on Nanocad x64 plus 20.0 - your lisp works. Quote
jim78b Posted April 23, 2020 Author Posted April 23, 2020 MY VERSION IS the last nanocad pro 11, the list don't permit me to set the second reference point Quote
jim78b Posted April 23, 2020 Author Posted April 23, 2020 ok i resolve the lisp rtc now i have a lisp of leemac that rename a block but don't work ;;-----------------=={ Copy/Rename Block Reference }==------------------;; ;; ;; ;; This program allows a user to copy and/or rename a single block ;; ;; reference in the working drawing. ;; ;; ;; ;; Many existing programs enable the user to rename the block ;; ;; definition for a given block reference, with the new name ;; ;; subsequently reflected across all references of the block ;; ;; definition in the drawing. However, this program will allow a ;; ;; single selected block reference to be renamed (or for the user to ;; ;; create a renamed copy of the selected block reference), by ;; ;; generating a duplicate renamed block definition for the selected ;; ;; block. ;; ;; ;; ;; The program may be called from the command-line using either 'CB' ;; ;; to create a renamed copy of a selected block reference, or 'RB' to ;; ;; simply rename the selected block reference. ;; ;; ;; ;; Following selection of a block reference, the user is prompted to ;; ;; specify a name for the selected/copied block reference; a default ;; ;; block name composed of the original block name concatenated with ;; ;; both an underscore and the minimum integer required for uniqueness ;; ;; within the block collection of the active drawing is offered. ;; ;; ;; ;; The program will then proceed to duplicate the block definition ;; ;; using the new block name. To accomplish this without resulting in ;; ;; a duplicate key in the block collection of the active drawing, the ;; ;; program utilises an ObjectDBX interface to which the block ;; ;; definition of the selected block reference is deep-cloned, renamed, ;; ;; and then deep-cloned back to the active drawing. This method also ;; ;; enables Dynamic Block definitions to be successfully copied ;; ;; & renamed. ;; ;; ;; ;; Finally, this program will perform successfully in all UCS/Views ;; ;; and is compatible with Anonymous Blocks, Dynamic Blocks & XRefs. ;; ;;----------------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2013 - www.lee-mac.com ;; ;;----------------------------------------------------------------------;; ;; Version 1.5 - 05-07-2013 ;; ;;----------------------------------------------------------------------;; (defun c:cb nil (LM:RenameBlockReference t)) (defun c:rb nil (LM:RenameBlockReference nil)) (defun LM:RenameBlockReference ( cpy / *error* abc app dbc dbx def doc dxf new old prp src tmp vrs ) (defun *error* ( msg ) (if (and (= 'vla-object (type dbx)) (not (vlax-object-released-p dbx))) (vlax-release-object dbx) ) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\nError: " msg)) ) (princ) ) (while (progn (setvar 'errno 0) (setq src (car (entsel (strcat "\nSelect block reference to " (if cpy "copy & " "") "rename: ")))) (cond ( (= 7 (getvar 'errno)) (princ "\nMissed, try again.") ) ( (= 'ename (type src)) (setq dxf (entget src)) (cond ( (/= "INSERT" (cdr (assoc 0 dxf))) (princ "\nPlease select a block reference.") ) ( (= 4 (logand 4 (cdr (assoc 70 (tblsearch "layer" (cdr (assoc 8 dxf))))))) (princ "\nSelected block is on a locked layer.") ) ) ) ) ) ) (if (= 'ename (type src)) (progn (setq app (vlax-get-acad-object) doc (vla-get-activedocument app) src (vlax-ename->vla-object src) old (vlax-get-property src (if (vlax-property-available-p src 'effectivename) 'effectivename 'name)) tmp 0 ) (while (tblsearch "block" (setq def (strcat (vl-string-left-trim "*" old) "_" (itoa (setq tmp (1+ tmp))))))) (while (and (/= "" (setq new (getstring t (strcat "\nSpecify new block name <" def ">: ")))) (or (not (snvalid new)) (tblsearch "block" new) ) ) (princ "\nBlock name invalid or already exists.") ) (if (= "" new) (setq new def) ) (setq dbx (vl-catch-all-apply 'vla-getinterfaceobject (list app (if (< (setq vrs (atoi (getvar 'acadver))) 16) "objectdbx.axdbdocument" (strcat "objectdbx.axdbdocument." (itoa vrs)) ) ) ) ) (if (or (null dbx) (vl-catch-all-error-p dbx)) (princ "\nUnable to interface with ObjectDBX.") (progn (setq abc (vla-get-blocks doc) dbc (vla-get-blocks dbx) ) (vlax-invoke doc 'copyobjects (list (vla-item abc old)) dbc) (if (wcmatch old "`**") (vla-put-name (vla-item dbc (1- (vla-get-count dbc))) new) (vla-put-name (vla-item dbc old) new) ) (vlax-invoke dbx 'copyobjects (list (vla-item dbc new)) abc) (vlax-release-object dbx) (if cpy (setq src (vla-copy src))) (if (and (vlax-property-available-p src 'isdynamicblock) (= :vlax-true (vla-get-isdynamicblock src)) ) (progn (setq prp (mapcar 'vla-get-value (vlax-invoke src 'getdynamicblockproperties))) (vla-put-name src new) (mapcar '(lambda ( a b ) (if (/= "ORIGIN" (strcase (vla-get-propertyname a))) (vla-put-value a b) ) ) (vlax-invoke src 'getdynamicblockproperties) prp ) ) (vla-put-name src new) ) (if (= :vlax-true (vla-get-isxref (setq def (vla-item (vla-get-blocks doc) new)))) (vla-reload def) ) (if cpy (sssetfirst nil (ssadd (vlax-vla-object->ename src)))) ) ) ) ) (princ) ) ;;----------------------------------------------------------------------;; (vl-load-com) (princ (strcat "\n:: CopyRenameBlock.lsp | Version 1.5 | \\U+00A9 Lee Mac " (menucmd "m=$(edtime,$(getvar,date),YYYY)") " www.lee-mac.com ::" "\n:: Available Commands:" "\n:: \"CB\" - Copy & Rename Block Reference." "\n:: \"RB\" - Rename Block Reference." ) ) (princ) ;;----------------------------------------------------------------------;; ;; End of File ;; ;;----------------------------------------------------------------------;; Quote
BIGAL Posted April 23, 2020 Posted April 23, 2020 Not sure if Nanocad supports Visual Lisp the VL- so a simple test. Type this (vl-load-com) T should appear if error message then no VL then type (setq obj (vlax-ename->vla-object (car (entsel "Pick object ")))) Pick object #<VLA-OBJECT IAcadLine 000000002D06C1F0> I picked a line Quote
BIGAL Posted April 24, 2020 Posted April 24, 2020 (vl-load-com) to command line if T then (setq obj (vlax-ename->vla-object (car (entsel "Pick object ")))) Quote
jim78b Posted April 25, 2020 Author Posted April 25, 2020 give me: _>: (setq obj (vlax-ename->vla-object (car (entsel "Pick object ")))) Pick object error: invalid argument type: LENTITYP: nil Quote
hanhphuc Posted April 26, 2020 Posted April 26, 2020 18 hours ago, jim78b said: give me: _>: (setq obj (vlax-ename->vla-object (car (entsel "Pick object ")))) Pick object error: invalid argument type: LENTITYP: nil seems you just picked nothing? Quote
jim78b Posted April 26, 2020 Author Posted April 26, 2020 But don't me Permit to select anything Quote
maratovich Posted April 26, 2020 Posted April 26, 2020 2 hours ago, jim78b said: But don't me Permit to select anything Maybe another version will help you.Here is the link to version 20.0nanoCAD Plus 20.0 x64I don’t know if there are different languages or not. But I think that it will not be difficult to understand. The teams are the same as in AutoCAD. Quote
jim78b Posted April 26, 2020 Author Posted April 26, 2020 (edited) SORRY BUT I WENT TO THE ENGLISH SITE AND DOWNLOAD THE TRIAL ...IS 11! https://nanocad.com/products/plus/ IN NANOCAD i call the console with lsp then C copy : (vl-load-com) and press enter nothing happen then paste: if T then (setq obj (vlax-ename->vla-object (car (entsel "Pick object ")))) and press enter now ASK ME TO PICK AN OBJECT SO IT WORKS. AND now what shall i do? Edited April 26, 2020 by jim78b Quote
BIGAL Posted April 27, 2020 Posted April 27, 2020 (vl-load-com) (setq obj (vlax-ename->vla-object (car (entsel "Pick object ")))) Quote
jim78b Posted April 27, 2020 Author Posted April 27, 2020 Sorry not understand now what should have i do ? Quote
BIGAL Posted April 28, 2020 Posted April 28, 2020 (edited) When I type (vl-load-com) on the command line it displays "T" meaning it has loaded. If it reports a ERROR then the code you originally posted will not work as it has Visual lisp functions and does not work with Nanocad You need to post the error messages not just say it does not work. Edited April 28, 2020 by BIGAL 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.