BIGAL Posted December 23, 2019 Posted December 23, 2019 Have a look at image for pick sequence. Ok lets walk before we run make it work for 1 lane 1st then consider dual lanes. 1 Quote
Sheep Posted December 26, 2019 Author Posted December 26, 2019 Hi to all. I tried making the LISP but it stated "; error: malformed string on input". How do i fix it? 2. How do i start a sub routine in the LISP ( at defun rad() line? (defun c:lp (/ a b c p1 p2 p3 p4 p5 jSedia lebr) (rad) (setq p1 (getpoint "\nPoint 1: ")) (setq p2 (getpoint p1 "\nPoint 2: ")) (setq p3 (getpoint p1 "\nPoint 3: ")) (setq p4 (getpoint "\nPoint S1: ")) (setq p5 (getpoint p4 "\nPoint S2: ")) (setq lebr (getreal "\nNew Width: ")) (setq jSedia (getreal "\nExisting lane width: ")) (command "_layer" "_m" "garis_putus" "_c" "1" "" "l" "HIDDEN" "" "") (command "pline" p1 p2 p3 "" ) (setq a (entlast)) (command "_offset" lebr a pause "") (command ".erase" a "" "") (command "pline" p4 p5 "" ) (setq b (entlast)) (command "_offset" jSedia b pause "") (command ".erase" b "" ) (princ) (defun rad () (setq c (entsel \nPick existing line: ")) ) (princ) ) Quote
devitg Posted December 26, 2019 Posted December 26, 2019 (edited) (defun rad () (setq c (entsel "\nPick existing line: ")) ) (princ) ) (defun rad () (setq c (entsel "\nPick existing line: ")) ; you miss the double quote ) (princ) ) Also it shall be (defun rad () (setq c (car (entsel "\nPick existing line: "))) ) (princ) ) As entsel give a two values in a list . First the Entity name , and second , the point where you pick Like it (<Entity name: 32c94df0> (63.6889 178.353 0.0)) and for (defun rad () (setq c (car (entsel "\nPick existing line: "))) ) (princ) ) will give <Entity name: 32c94df0> Edited December 26, 2019 by devitg add tip 1 Quote
Sheep Posted December 27, 2019 Author Posted December 27, 2019 (edited) Thanks @devitg. 1. Can you teach me how do i select two lines (pline) and fillet it with user input value for the radius? 2. Is the below code structure correct? Does that mean i can create multiple routine and the LISP will execute one by one starting from routine1 to routune2 etc? (defun routine1 () calculations codes... (princ) ) (defun routine2() another codes... (princ) ) (defun c:LP) (routine1) (routine2) (princ) ) 3. Can i set multiple "entlast" in a single routine (e.g routine1)? Example: (setq a (entlast)) ;This is in routine1 (setq b (entlast)) ;This is in routine1 (setq a (entlast)) ;This is in routine2 (setq b (entlast)) ;This is in routine2 Will it cause conflict between routine1 and routine2 because both contains (setq a) and (setq b)? Thank you for your time and answer. Edit post: When i run this LISP, it will state "Unkown command LP". (defun Pilhn () (setq p1 (getpoint "\nPoint satu: ")) (setq p2 (getpoint p1 "\nPoint dua: ")) (setq p3 (getpoint p1 "\nPoint ketiga: ")) (setq p4 (getpoint "\nPoint S1: ")) (setq p5 (getpoint p4 "\nPoint S2: ")) (setq lebr (getreal "\nLebar lorong baharu: ")) (setq jSedia (getreal "\nLebar lorong simpang sediada: ")) ); End defun Pilhn (defun JlnUtama () (command "_layer" "_m" "garis_putus" "_c" "1" "" "l" "HIDDEN" "" "") (command "pline" p1 p2 p3 "" ) (setq a (entlast)) (command "_offset" lebr a pause "") (setvar "nomutt" 0) (command ".erase" a "" "") (princ) );End defun JlnUtama (defun JlnSp () (command "_layer" "_m" "garis_sediada" "_c" "2" "" "l" "HIDDEN" "" "") (command "pline" p4 p5 "" ) (setq b (entlast)) (command "_offset" jSedia b pause "") (setvar "nomutt" 0) (command ".erase" b "" "") (princ) ) (defun c:LP () (Pilhn) (JlnUtama) (JlnSp) (princ) ) How do i make cmdecho or nomutt with my own text (language)? Edited December 27, 2019 by Sheep Don't want to clutter the thread with multiple new question. Quote
BIGAL Posted December 28, 2019 Posted December 28, 2019 (edited) Worked for me up to loading and typing LP. Re pline fillet look at code I already posted. Edited December 28, 2019 by BIGAL Quote
Sheep Posted January 7, 2020 Author Posted January 7, 2020 1.What's the different between command and command-s? when should i use command-s? 2. How do i use command LENGTHEN for the red line? I want it base on user input. Is it : (command "LENGTHEN" "total" <user input> entlast) Quote
Sheep Posted January 17, 2020 Author Posted January 17, 2020 I've made some code but it seems that it skips some steps. The Pilhn is not yet finish but buatLmLd already kicks in. Any help would be great helping a newbie. Thanks. (defun Pilhn () ;;Ni utk user buat pilihan (setq radS (getreal "\n Radius jalan:[12.00] ")) (setq GarisUtama (getpoint "\nPilih garis baharu jalan utama: ")) (setq GarisSimpang (getpoint "\nPilih garis baharu simpang: ")) ;(setvar "cmdecho" 0) (setvar 'filletrad radS) (command "fillet" "trim" "N" GarisUtama GarisSimpang) (setq radUtama (entlast)) (command "TRIM" radUtama "" "f") ;(setvar "cmdecho" 1) (princ) ) ; End defun Pilhn (defun buatLmLd () (setvar "cmdecho" 0) (prompt "\n Pilih garis untuk LM atau Td: ") (setq GUtma (ssget)) (setq JrkLm (getreal "\n Jarak Lm atau Ld:<Kelajuan per jarak>: ")) (command "lengthen" "t" JrkLm GUtma "") (princ) ) Quote
Sheep Posted January 23, 2020 Author Posted January 23, 2020 (edited) Slow progress by a newbie. But atleast, im going somewhere. How do i make pline with a distance and snap it to the lane line? ac.mp4 Edited January 23, 2020 by Sheep 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.