×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Elipses and offsets to Acad and Polylines...argh...

Elipses and offsets to Acad and Polylines...argh...

Elipses and offsets to Acad and Polylines...argh...

(OP)
Anyone else dealing with this.  I have some geometry that has elipses and offsets from elipses which of course create splines.  This geometry is then Saved as a dwg file to open in Acad and make closed polylines out of.  Problem is it seems, that Acad can't make splines or elipses into polylines!  I'm working on some other work arounds (tif files), but to keep with company process flow, the Acad polyline road is the one preferred.

What say you all?

John

RE: Elipses and offsets to Acad and Polylines...argh...

I say just keep it all in SW and you won't have any problems.

The problem sounds like its an AUtoCAD Limitation and that you might bring this up in their Forum.

Regards,

Scott Baugh, CSWP
3DVision Technologies

www.3dvisiontech.com
www.scottjbaugh.com
FAQ731-376
FAQ559-716 - SW Fora Users

RE: Elipses and offsets to Acad and Polylines...argh...


S2P (Spline to pline)


CODE

;CADALYST 12/03 AutoLISP Solutions SPLINE-TO-PLINE.LSP
;;(c) 2003 Tony Hotchkiss

(defun spline-to-pline (/ i)
(vl-load-com)
(setq *thisdrawing* (vla-get-activedocument
(vlax-get-acad-object)
) ;_ end of vla-get-activedocument
*modelspace* (vla-get-ModelSpace *thisdrawing*)
) ;_ end of setq
(setq spline-list (get-spline))
(setq i (- 1))
(if spline-list
(progn
(setq msg "\nNumber of segments <100>: ")
(initget 6)
(setq num (getint msg))
(if (or (= num 100) (= num nil))
(setq num 100)
) ;_ end of if
(repeat (length spline-list)
(setq splobj (nth (setq i (1+ i)) spline-list))
(convert-spline splobj num)
) ;_ end of repeat
) ;_ end of progn
) ;_ end of if
) ;_ end of spline-to-pline

(defun get-spline (/ spl-list obj spline no-ent i)
(setq spl-list nil
obj nil
spline "AcDbSpline"
selsets (vla-get-selectionsets *thisdrawing*)
ss1 (vlax-make-variant "ss1")
) ;_ end of setq
(if (= (vla-get-count selsets) 0)
(setq ssobj (vla-add selsets ss1))
) ;_ end of if
(vla-clear ssobj)
(setq no-ent 1)
(while no-ent
(prompt "\nSelect splines: ")
(vla-Selectonscreen ssobj)
(if (> (vla-get-count ssobj) 0)
(progn
(setq no-ent nil)
(setq i (- 1))
(repeat (vla-get-count ssobj)
(setq
obj (vla-item ssobj
(vlax-make-variant (setq i (1+ i)))
) ;_ end of vla-item
) ;_ end of setq
(cond
((= (vlax-get-property obj "ObjectName") spline)
(setq spl-list
(append spl-list (list obj))
) ;_ end of setq
)
) ;_ end-of cond
) ;_ end of repeat
) ;_ end of progn
(prompt "\nNo entities selected, try again.")
) ;_ end of if
(if (and (= nil no-ent) (= nil spl-list))
(progn
(setq no-ent 1)
(prompt "\nNo splines selected.")
(quit)
) ;_ end of progn
) ;_ end of if
) ;_ end of while
(vla-delete (vla-item selsets 0))
spl-list
) ;_ end of get-spline

(defun convert-spline (splobj n / i)
(setq point-list nil
2Dpoint-list nil
z-list nil
spl-lyr (vlax-get-property splobj 'Layer)
startSpline (vlax-curve-getStartParam splobj)
endSpline (vlax-curve-getEndParam splobj)
i (- 1)
) ;_ end of setq
(repeat (+ n 1)
(setq i (1+ i))
(setq p (vlax-curve-getPointAtParam
splobj
(* i
(/ (- endspline startspline) n)
) ;_ end of *
) ;_ end of vlax-curve-getPointAtParam
) ;_ end of setq
(setq 2Dp (list (car p) (cadr p))
2Dpoint-list (append 2Dpoint-list 2Dp)
point-list (append point-list p)
z (caddr p)
z-list (append z-list (list z))
) ;_ end of setq
) ;_ end of repeat
(setq summ (apply '+ z-list))
(setq arraySpace
(vlax-make-safearray
vlax-vbdouble ; element type
(cons 0
(- (length point-list) 1)
) ; array dimension
) ;_ end of vlax-make-safearray
) ;_ end of setq
(setq vert-array (vlax-safearray-fill arraySpace point-list))
(vlax-make-variant vert-array)
(if (and (= :vlax-true (vlax-get-property splobj 'IsPLanar))
(= summ 0.0)
) ;_ end of and
(setq plobj (add-polyline
2Dpoint-list
vla-AddLightweightPolyline
) ;_ end of add-polyline
) ;_ end of setq
(setq plobj (add-polyline
point-list
vla-Add3DPoly
) ;_ end of add-polyline
) ;_ end of setq
) ;_ end of if
(vlax-put-property plobj 'Layer spl-lyr)
(vla-delete splobj)
(vlax-release-object splobj)
) ;_ end of convert-spline

(defun add-polyline (pt-list poly-func)
(setq arraySpace
(vlax-make-safearray
vlax-vbdouble
(cons 0
(- (length pt-list) 1)
) ; array dimension
) ;_ end of vlax-make-safearray
) ;_ end of setq
(setq vertex-array
(vlax-safearray-fill arraySpace pt-list)
) ;_ end of setq
(vlax-make-variant vertex-array)
(setq plobj (poly-func
*modelspace*
vertex-array
) ;_ end of poly-func
) ;_ end of setq
) ;_ end of add-polyline

(defun c:s2p ()
(spline-to-pline)
(princ)
) ;_ end of c:s2p

(prompt
"SPLINE-TO-PLINE by Tony Hotchkiss. Enter S2P to start"
) ;_ end of prompt

Flores

RE: Elipses and offsets to Acad and Polylines...argh...

I agree with Scott. Keep it all in SolidWorks.
I am not a big fan of ACAD or having two CAD's at same company.

Chris
Sr. Mechanical Designer, CAD
SolidWorks 05 SP3.1 / PDMWorks 05
ctopher's home site

FAQ559-1100
FAQ559-716

RE: Elipses and offsets to Acad and Polylines...argh...

We save some our drawings as DXF's to send to Laser/Water jet guys.  I am not into sado-masochism, so I stay away from the DWG Editor.  I use ACAD to modify or clean up any DXF's.  

Flores

RE: Elipses and offsets to Acad and Polylines...argh...

Maybe a dumb question, but why do you need to convert to polylines?


Making the best use of this Forum.  FAQ559-716
How to get answers to your SW questions.  FAQ559-1091
Helpful SW websites every user should be aware of.  FAQ559-520

RE: Elipses and offsets to Acad and Polylines...argh...

(OP)
CBL, it's not a dumb question.  It's a issue that goes back in history and has carried it's way thru to today in some ways, similar to the way Apple computer stuck around due to the huge publishing base it maintained (I'm not going into that debate).  Polylines have properties specific to printing certain kinds data.  Etching, gerber translation, etc.  But I've seen different companies work with different files, it's not a set in stone thing.  But I'm deal with an ACAD system that has been in place for a long long time...hopefully "resistance is futile" and I'll win them over.  It's a tough blend of environments and it will take some work to get it flowing nicely, but not impossible.  I have many supporters at the company, but no back up to myself hence SW one disadvantage, I'm the only one who can use it!  ARGH....again.

smcadman,
  Can you explain that code a bit more.  Thanks.

John

RE: Elipses and offsets to Acad and Polylines...argh...

Hi, You can create polyline ellipses in AutoCad.  PELLIPSE default value is 0, set to 1,  then create an ellipse.  It will be polylines...

RE: Elipses and offsets to Acad and Polylines...argh...

Can't you do this process in a SW dwg? Save as DXF, open it and fix as needed? Or use DWGEditor. I create artwork and do not have a problem with it.
Just a suggestion.

Chris
Sr. Mechanical Designer, CAD
SolidWorks 05 SP3.1 / PDMWorks 05
ctopher's home site

FAQ559-1100
FAQ559-716

RE: Elipses and offsets to Acad and Polylines...argh...

Solidsmaster,
Not sure if you need help using LISP, or just want to know what it does.  Copy the code, and save it in notepad with the extension of .lsp, NOT .txt.  Or you can type in "Vlisp" at the command line, hit New, and paste it there and save it (this will give you syntax coloring).  

After saving the file, load it, enter "S2P" and it will ask you to pick the spline.  After picking the spline, you will be prompted with "Number of segments <100>:"  Since this routine converts the spline to straight lines, you do not want to enter a low number of segments.  

You could do as Claymation suggested by tracing your ellipse after changing "pellipse" to 1.

Flores

RE: Elipses and offsets to Acad and Polylines...argh...

I don't know if this will be any help to you but there is an exact formula for offset curves to any polynomial in parametric form.

http://mathworld.wolfram.com/ParallelCurves.html

RE: Elipses and offsets to Acad and Polylines...argh...

(OP)
Thanks all, believe me I'd love to keep it all in Solidworks, but I'm greatly outnumbered and trying not to shake things up too much.  A couple of co-workers are all ready using words like "hero" and "fantastic", so who wants to dent the good rep!!  Especially sinces it's a new job.

Thanks again, and keep the ideas coming!

john

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources