Jump to content

Recommended Posts

Posted

Hello Users,

This is my first post here, but I have visited on occasion to solve issues in the past. I now find myself in a position that I am not sure I can solve just by browsing the forums, maybe someone here can lend a hand.

I have been using CAD software in various design jobs since 1999. However, I have never had to utilize LISP routines.

My newest job has presented me with a request that has stumped me. The more I research on it, the more confused I get.

I have been a fan of building my own PC's that can handle the heavy loads of 3D designs and renderings. Hardware is a piece of cake for me. However, when I try and study the mechanics of writing LISP routines my brain starts to hurt. I have seen plenty of examples of various LISP routines out there, but looking at the coding that's involved just makes me go cross-eyed. This is something I want to get better at, but I need some help.

First off....I have Tuesday morning meetings every other week that involve multiple departments where I work. The latest project involved equipment moves on the plants production floor. One of the moves we had to make was to move a racking system in order to hold longer product. By moving the racks we ended up eating into the aisle that pedestrians use. We had to put a little jog in the aisle and make sure that the forklifts could still access the area. So, I measured and drew the footprint of the forklift that they use and placed it in the aisle. Then I just copied it multiple times to show that the forklift fits and can make the little turns that we put in the aisle. Piece of cake, no thought involved in it really.

However, we had a special request to animate the forklift block to show it moving down the aisle, make the slight turns and continuing down the aisle with no issues of equipment getting in the way. Forklift will be driving sideways and holds a 16' long pallet and the turns will be tight.

This is all in 2D. I know there are some decent animation software packages out there, but they all seem to use 3D models. Not a big deal, but we aren't buying new software to do this, have to keep it within AutoCAD 2017 that we currently use.

Is there a way to do what they want, keep it in 2D and have the entire LISP routine select the forklift block, move it down the aisle, around the turns and make it appear to be animated?

I would love to learn more about the mechanics of writing these routines, but coding really confuses me. I need something that can help me break down the basics of writing these routines and understand the structure involved with all those confusing lines of text!

If it requires a phone call and a few lessons over the phone I'm up for that! If someone has a 'LISP Routines for Dummies" link, I am all for that as well. Not opposed to learning it on my own, but the pc screen has never answered my questions when I raise my hand!

Any help you gurus can lend would be greatly appreciated.

Thanks in advance,

Dave

Posted (edited)

This will do what you want as a very simple 2D plan no animation, we use it check vehicle driveway entrances in a vertical sense to make sure the car does not bottom out. With the delay it appears animated.

 

You need to replace the Holden.dwg, Aussie car block with your fork lift shape as a block, the critical thing here is the insertion point is the front wheel touching the ground, the wheelbase is hard coded so you will need to change that as well. You can add a "DELAY" so when running it would appear to be animated rather than a splat result. The code is written for metric but you could quickly rescale a foot plan as I have never tested in feet.

 

Ok redid it as a very dumb forklift with a metric 16' wide object. Image is 1.0 spacing I suggest edit my dwg. Made a simple 3d and have a think about feet version. See red pline is path for forklift.

 

The other way but no idea for a forklift shape is using Autoturn or the inbuilt vehicle checker in CIV3d. Not sure how you can make your own shape.

 

(Defun draw_vehicle ( )

(SETQ ANGBASEE (GETVAR "ANGBASE"))
(SETQ ANGDIRR (GETVAR "ANGDIR"))
(SETQ LUNITSS (GETVAR "LUNITS"))
(SETQ LUPRECC (GETVAR "LUPREC"))
(SETQ AUNITSS (GETVAR "AUNITS"))
(SETQ AUPRECC (GETVAR "AUPREC"))
(setq oldsnap (getvar "osmode"))

(SETVAR "LUNITS" 2)
(SETVAR "ANGBASE" 0.0)
(SETVAR "ANGDIR" 0)
(SETVAR "LUPREC" 0)
(SETVAR "AUNITS" 3)
(SETVAR "AUPREC" 0)
(setvar "osmode" 0)

(if (tblsearch "Block" "Fork")
(princ "Holden")
(progn
(command "Insert" "p:\\Autodesk\\vba\\holdencar.dwg" "0,0" 1 1 0)
;(command "erase" "last" "")
) ; progn
)

(setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline"))))

(setq interval ( getreal "\nEnter spacing m:"))

(setq cRad 1.5) ; forklift wheel base
(setq startang (* pi 1.5))
(setq endang (/ pi 2.0))
(setq dist 0.0)

(setq len (vla-get-length obj))
(setq stpt (vlax-curve-getpointatdist obj interval))

(setq num (+ 1 (fix ( / len interval))))

(repeat num

(command "arc" "C" stpt (polar stpt endang crad)(polar stpt startang crad))
(setq objarc (vlax-ename->vla-object (entlast)))

(if (= (setq intpt (vlax-invoke obj 'intersectWith objarc acExtendnone)) nil)
(setq intpt (vlax-invoke obj 'intersectWith objarc acExtendThisEntity)) ; needed at start
)

(vla-delete objarc)
(setq ang (angle intpt stpt))


(command "Insert" "Fork" stpt 1 1 ang) ; need ang in radians

(setq stpt (vlax-curve-getpointatdist obj (setq dist (+ dist interval))))
(command "delay" 500) ; change this for speed of drawing
; (command "erase" "L" "") if you want 1 at a time
) ; repeat

(SETVAR "LUNITS" lunitss)
(SETVAR "ANGBASE" angbasee)
(SETVAR "ANGDIR" angdirr)
(SETVAR "LUPREC" luprecc)
(SETVAR "AUNITS" aunitss)
(SETVAR "AUPREC" auprecc)

(princ)



) ; defun


(draw_vehicle)

Forklift.dwg

ScreenShot116.jpg

Edited by BIGAL
Posted

really nice BIGAL! just one tiny tiny thingy : (command "delay "500") -> (command "delay" 500)

 

gr. Rlx

Posted

Thanks typed directly here not in code tested.

 

My new car travelling down the production line.

ScreenShot117.jpg

Posted

I attached a copy of the area I am working with.

 

Just trying to get this forklift down the path so it doesn't hangover any of the aisle lines as it travels down the path...

forklift path animation.dwg

Posted

Not quite sure what it is you want, you need to join the pallet to the fork lift, modify the code to reflect the wheel base 68 ? Set the two points that control the radial movement, then draw a pline and it should move along.

 

One thing to be aware of is you can computer model it to work but does the guy on the fork lift change direction just as fast ?

Screen Shot 03-27-18 at 01.06 PM.jpg

Posted

Appreciate all the responses and guidance.

 

The goal was to animate the forklift just to show it driving down the aisle, making the turns and continuing down the aisle without running into anything on the other side on the aisle lines.

 

I originally thought i could figure out a lisp routine that would execute a bunch of move commands along with slight turns to get through the dog leg of the aisle all while moving forward.

 

What I ended up doing was just using MSLIDE and making a script with about 80 slides. It 'works' but is a little bit choppy, seems to be from the network traffic and the fact work doesn't provide high end computers for this kind of stuff. If I let the script execute a few times it seems the cache builds up and it smooths out a little bit, enough for this presentation this morning anyway.

 

I was not able to figure out a lisp routine, but my desires to learn that feature has not faltered.

 

Wish it came as easy to me as the script writing!

Posted

Pity you did not work out the lisp as it draws it looks like an animation, I changed the code to work with your dwg as per image above. Adding the mslide is very doable and rendering as you go would be interesting. Need a simple 3d forklift to do it justice.

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