Jump to content

Recommended Posts

Posted

 

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.

 

image.thumb.png.35f8542c60fa352c85212c1caf85bd35.png

  • Thanks 1
Posted

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)
)

 

Posted (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 by devitg
add tip
  • Thanks 1
Posted (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 by Sheep
Don't want to clutter the thread with multiple new question.
Posted (edited)

Worked for me up to loading and typing LP.

 

Re pline fillet look at code I already posted.

Edited by BIGAL
  • 2 weeks later...
Posted

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)

 

0.PNG

  • Sheep changed the title to AC/DC lane LISP (people said many friendly expert in here. Please respond)
Posted

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)
	 )

 

0.PNG

Posted (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?

Edited by Sheep

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...