+ Reply to Thread
Page 2 of 4 FirstFirst 1 2 3 4 LastLast
Results 11 to 20 of 37
  1. #11
    Junior Member
    Computer Details
    labmonkey's Computer Details
    Operating System:
    Windows 7
    Using
    AutoCAD 2010
    Join Date
    Aug 2009
    Location
    Japan
    Posts
    24

    Default

    Registered forum members do not see this ad.

    Thanks BIGAL,

    I will look into that. That may be simpler than using an external program (such as excel). In my previous post you can see some example of the original *.cel file. There are also a lot of lines containing 'nonsense', but they should be easily disgarded. My idea for using excel was that I can strip out the nonsense relatively easily and then insert cells where I need to containing commas, spaces, and text such as " _C _CHPROP _L _C 3 _HATCH _P _S _L _CHPROP _L _C 5" and then re-save it as the script.

    Quote Originally Posted by BIGAL View Post
    Also look at "read file" the same thing can be done without rewriting the csv to create a script using lisp you can read a line in work out the L & W and insertion pt and create a rectang or a pline, the lisp just keeps going till it hits end of file.

    How can I create this from a csv file? for example 0 0 10 5. A csv is a comma seperated variable file 0,0,10,5 you have a space delimited file, good news it doesn't matter just need to tell lisp to use space or ,

    Post a few lines of the csv

  2. #12
    Junior Member
    Computer Details
    labmonkey's Computer Details
    Operating System:
    Windows 7
    Using
    AutoCAD 2010
    Join Date
    Aug 2009
    Location
    Japan
    Posts
    24

    Default

    So, I'm still confused with this script.
    Code:
    _PLINE -79.289,-229.289 -79.289,-200 20.711,-200 20,711,-229.289 _CLOSE 
    _LINE -96.860,32.583 56.082,32.583 
    _ZOOM E
    (edit: there is a space after "_ZOOM E", but it's not showing above for reasons I guess due to the forum software.)
    If I literally copy the above code and paste it into the command line it does exactly what I expect and this is seen in the command line window.
    Command: _PLINE
    Specify start point: -79.289,-229.289
    Current line-width is 0.0000
    Specify next point or [Arc/Halfwidth/Length/Undo/Width]: -79.289,-200
    Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: 20.711,-200
    Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: 20,711,-229.289
    2D point or option keyword required.
    Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: _CLOSE
    Command:
    PLINE
    Specify start point: _LINE
    Invalid point.
    Specify start point: -96.860,32.583
    Current line-width is 0.0000
    Specify next point or [Arc/Halfwidth/Length/Undo/Width]: 56.082,32.583
    Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
    Command: _ZOOM
    Specify corner of window, enter a scale factor (nX or nXP), or
    [All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: E
    But, if I try to tun it as a script (there is nothing else at all in the script), it fails. It hangs while asking for the next point for the PLINE. This is what is seen in the command line window.
    Command: script
    Command: _PLINE
    Specify start point: -79.289,-229.289
    Current line-width is 0.0000
    Specify next point or [Arc/Halfwidth/Length/Undo/Width]: -79.289,-200
    Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: 20.711,-200
    Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: 20,711,-229.289
    2D point or option keyword required.
    Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: *Cancel*
    (The last cancel is after I hit escape to stop it from hanging.)

    Any ideas? It is really confusing me.

  3. #13
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,004

    Default

    Please check that you have used a comma (",") instead of a dot (".") which translate last input into a 3D point - the polyline command will accept a 3D point argument only for first point, all subsequent ones must be 2D:
    Code:
    _PLINE -79.289,-229.289 -79.289,-200 20.711,-200 20.711,-229.289 _CLOSE
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  4. #14
    Junior Member
    Computer Details
    labmonkey's Computer Details
    Operating System:
    Windows 7
    Using
    AutoCAD 2010
    Join Date
    Aug 2009
    Location
    Japan
    Posts
    24

    Default


    Thanks!
    I cannot believe I was so dumb!
    I've been staring at that code for ages, and never noticed I'd accidentally used a comma instead of full stop!
    I think I have a follow up question in a couple of minutes.

  5. #15
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,004

    Default

    You're welcome!
    The "trick" is to check careful the messages AutoCAD is issuing to you; on the troublemaker input it was complaining that the format is not expected one for a 2D point.
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  6. #16
    Junior Member
    Computer Details
    labmonkey's Computer Details
    Operating System:
    Windows 7
    Using
    AutoCAD 2010
    Join Date
    Aug 2009
    Location
    Japan
    Posts
    24

    Default

    Quote Originally Posted by MSasu View Post
    You're welcome!
    The "trick" is to check careful the messages AutoCAD is issuing to you; on the troublemaker input it was complaining that the format is not expected one for a 2D point.
    Thanks. I was so convinced that the error was about closing the pline that I didn't consider I had a problem before that. I spent ages today trying various combinations of _CLOSE, _close, -CLOSE,.... etc.

    My follow up question (and hopefully last) is about this code, which is the shell of my final script.
    Code:
    _LINE -96.860,32.583 56.082,32.583  _CHPROP _L  _C 2  _HATCH _P _S _L  _CHPROP _L  _C 1 
    _RECTANGLE -69.138,-14.067 -15.304,14.531 _CHPROP _L  _C 2  _HATCH _P _S _L  _CHPROP _L  _C 2 
    _PLINE -79.289,-229.289 -79.289,-200 20.711,-200 20.711,-229.289 _CLOSE _CHPROP _L  _C 3  _HATCH _P _S _L  _CHPROP _L  _C 3 
    _COLOR 1 
    
    _MTEXT 20,5 _H 1 20,10 1.0  
    
    _COLOR 2 
    
    _MTEXT 20,3 _H 2 20,8 2.0  
    
    _COLOR 3 
    
    _MTEXT 20,1 _H 2 20,6 3.0  
    
    _ZOOM _E
    It seems to work completely fine the first time I run it. However, if I run it a second time (without either erasing or zooming or panning the drawing) some of the text in the _MTEXT command gets shifted. I don't think this will be a problem because I will only ever run the script once, but I am curious why it does it. Probably I am using the _MTEXT command incorrectly. I simply want (in this case) three lines of text, each in a different colour). Should I be clearing the memory somewhere?

    Apart from that, my next problem is how to extract the coordinates from the original *.cel file. I'll probably use some external program which I am more knowledgable about.

  7. #17
    Senior Member Blackfish's Avatar
    Using
    AutoCAD LT 2012
    Join Date
    Apr 2012
    Posts
    182

    Default

    Quote Originally Posted by labmonkey View Post
    It seems to work completely fine the first time I run it. However, if I run it a second time (without either erasing or zooming or panning the drawing) some of the text in the _MTEXT command gets shifted. I don't think this will be a problem because I will only ever run the script once, but I am curious why it does it. Probably I am using the _MTEXT command incorrectly. I simply want (in this case) three lines of text, each in a different colour). Should I be clearing the memory somewhere?
    I can run the above script as many times as I want and nothing is shifted; text, line and polylines are exactly as they should be (why not?) in the same place with or without zooming or panning.
    LT is still AutoCAD

  8. #18
    Junior Member
    Computer Details
    labmonkey's Computer Details
    Operating System:
    Windows 7
    Using
    AutoCAD 2010
    Join Date
    Aug 2009
    Location
    Japan
    Posts
    24

    Default

    Thanks. I'll try it on another computer later to make sure it's not just my machine.

  9. #19
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,004

    Default

    Quote Originally Posted by labmonkey View Post
    I was so convinced that the error was about closing the pline that I didn't consider I had a problem before that. I spent ages today trying various combinations of _CLOSE, _close, -CLOSE,.... etc.
    Always keep in mind the an error message is issued right after the trouble-maker input; is also true that for some cases the processing is resumed and the following inputs are retrieved on prompter that may cause more errors. So, focus to solve the first one, since the following others may be just consequences.
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  10. #20
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,004

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by labmonkey View Post
    I'll try it on another computer later to make sure it's not just my machine.
    Please try to disable the Osnap before run the script. Seems that, at least in AutoCAD 2010, the MText are affected by this feature.
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

Similar Threads

  1. Importing from an SDF file
    By LispNovice in forum Map 3D
    Replies: 2
    Last Post: 29th Jul 2011, 01:48 pm
  2. Importing points from a .txt file
    By toddcl in forum CAD Management
    Replies: 5
    Last Post: 8th Dec 2010, 09:28 pm
  3. Polygon problem when importing into max 2010
    By Massimofraga in forum 3D Modelling
    Replies: 5
    Last Post: 18th Nov 2009, 01:16 am
  4. Importing a other formatted file
    By Vikes_Fl in forum AutoCAD General
    Replies: 3
    Last Post: 19th Aug 2009, 01:54 pm
  5. Importing a tiff file
    By Willis in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 30th Oct 2008, 10:03 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts