Strange result with result

Discussion in 'AutoCAD' started by Marcel Janmaat, Apr 1, 2005.

  1. I have a routine in wich I change the value of an attribute within a block.
    Strangely enough, sometimes the attribute is changed to "1:100" instead of
    1:100. (without the quotes) It doesn't always happen. Sometimes it does, and
    somtimes not. There is no logical explanation for it in my opinion. The code
    is called from a script file.

    Does this sound familliar to any one?

    I hope so, beceause I don'n't have a clue.

    M
     
    Marcel Janmaat, Apr 1, 2005
    #1
  2. Marcel,

    It would be much easier for someone to help solve
    the problem if you could post the code in question.
     
    Jason Piercey, Apr 1, 2005
    #2
  3. Thanx Jason!

    But I think I've got it working now.

    In one case I had set a variable to "\"1:100\"" and in another case to
    "\(strcat \"1:\" \(rtos \(getvar \"dimscale\"\) 2 0\)\)"

    I moved the enclosure the \" outside the variable to the strcat. It seems to
    wor just fine now.

    See the << == in a part of the code below in case your interested;

    (if (/= pls "passend") ; als er geen vast formaat is geselecteerd...
    (if (> (length bnl) 1)
    (setq pls "\(strcat \"1:\" \(rtos \(getvar \"dimscale\"\) 2 0\)\)") ;
    schaal herleidt uit tekening conform dimscale
    ;(setq pls (strcat "\"" pls "\"")) << ==
    )
    (setq pls "fit") ;(setq pls "\"fit\"") << ==
    )

    ; StukHoofd Controleren
    (if (= shc "1")
    (if (> (length bnl) 1)
    (princ (strcat " \(c:shc\)\n" ; Stukhoofdcontrole bij meerdere
    tekeningen
    " \(command \"zoom\" \"all\"\)\n" ; Naar limits uitzoomen
    " \(command \"qsave\"\)\n" ; Save toepassen om aanpassingen niet
    verloren te laten gaan
    ) bst
    )
    ; Geen stukhoofdcontrole als er een deel van de huidige tekening wordt
    uitgeplot
    (if (and (equal wp1 (getvar "limmin")) (equal wp2 (getvar "limmax")))
    (princ (strcat " \(c:shc\)\n"
    " \(command \"zoom\" \"all\"\)\n"
    " \(command \"qsave\"\)\n"

    ) bst
    )
    )
    )
    )

    ; draworder instellen
    (princ " \(plt_ord '\(\"E_kgt\" \"E_wgt\" \"B_bwk\"\)\)\n" bst)
    (princ " \(command \"regen\")\n" bst) ; Regen altijd uitvoeren i.v.m.
    herindexatie plotorder!

    ; Eventueel bestaand plotbestand eerst verwijderen
    (princ " \(dos_delete bnm)\n" bst)
    ; Eventueel bestaand plotbestand eerst verwijderen

    (princ " \(setvar \"cmdecho\" 1)\n" bst)

    (princ " \(command \"plot\" " bst) ; plot commando
    (princ "\"y\" " bst) ; detailed plot
    configuration? [yes/No] <default>:
    (princ "\"\" " bst) ; Enter a layout name
    or [?] <default>:
    (princ "pln " bst) ; Enter an output
    devive name or [?] <default>:
    (princ "afm " bst) ; Enter paper size or
    [?] <default>:
    (princ "\"m\" " bst) ; Enter paper units
    [Inches/Millimeters <default>:
    (princ "rot " bst) ; Enter drawing
    orientation [Portrait/Landscape] <default>:
    (princ "usd " bst) ; Plot upside down?
    [Yes/No] <default>:
    (princ "\"w\" " bst) ; Enter plot area
    [Display/Extents/Limits/View/Window] <default>:
    (princ "wp1 " bst) ; Enter lower left
    corner of window <default>:
    (princ "wp2 " bst) ; Enter upper right
    corner of window <default>:
    (if (= pls "\(strcat \"1:\" \(rtos \(getvar \"dimscale\"\) 2 0\)\)") << ==
    (princ (strcat "" pls " ") bst) << ==
    (princ (strcat "\"" pls "\" ") bst) ; Enter plot scale
    (Plotted Millimeters=Drawing Units) or [Fit] <default>: << ==
    ) << ==
    (princ "plo " bst) ; Enter plot offset
    (x,y) or
    <default>:
    (princ "\"y\" " bst) ; Plot with plot
    styles? [Yes/No] <default>:
    (prin1 H_cadctb bst) ; Enter plot style
    table name or [?] (enter . for none) <default>:
    (princ " \"y\"\)\n" bst) ; Plot with
    lineweights? [Yes/No] <default>:
    (princ " \(if \(= \(getvar \"tilemode\"\) 1\) \(command " bst) ; Als
    er vanuit modelspace wordt geplot...
    (princ "\"n\"\) " bst) ; Remove hidden lines?
    [Yes/No] <default>:
    (princ "\(command " bst) ; Als er vanuit
    paperspace wordt geplot...
    (princ "\"n\" " bst) ; *paperspace* -> Scale
    lineweights with plot scale? [Yes/No] <default>:
    (princ "\"n\" " bst) ; *paperspace* -> Plot
    paper space last? [Yes/No] <default>:
    (princ "\"n\"\)\)\n" bst) ; Remove hidden lines?
    [Yes/No] <default>: (+ einde if statement)
    (princ " \(command \"y\" " bst) ; Write the plot to a
    file [Yes/No] <default>:
    (princ "bnm " bst) ; Enter file name
    <default>:
    (princ "\"y\" " bst) ; Save changes to model
    tab [Yes/No]? <default>:
    (princ "\"y\" \)\n" bst) ; Proceed with plot
    [Yes/No] <default>:​
     
    Marcel Janmaat, Apr 1, 2005
    #3
  4. Glad you got it working.
     
    Jason Piercey, Apr 1, 2005
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.