Spirax Posted January 16, 2018 Share Posted January 16, 2018 Hi all, Really need a hand here. I have slightly edited the program from Lee Mac "areas2field" and added the line (setq format "%lu2%pr2%ps[, ha]%ct8[0.0001]") ;; Field Formatting This allows me to select a boundary and return the reading as an area in hectares, example output is "12.35 ha" I would like to modify output to also convert to acres for it to read like this "5.00 ac / 12.35 ha" Appreciated your help in advance. Quote Link to comment Share on other sites More sharing options...
Spirax Posted January 16, 2018 Author Share Posted January 16, 2018 BTW, I attempted something like this (setq format "%lu2%pr2%ps[, ac]%ct8[0.0002471044] / %lu2%pr2%ps[, ha]%ct8[0.0001]") ;; Field Formatting Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 16, 2018 Share Posted January 16, 2018 Are you using Version 1.3 of the program from here? Quote Link to comment Share on other sites More sharing options...
Spirax Posted January 16, 2018 Author Share Posted January 16, 2018 Are you using Version 1.3 of the program from here? Hi Lee, yes that's correct. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 17, 2018 Share Posted January 17, 2018 Your code snippet made me think otherwise, as the current code does not have a 'format' variable. Nevertheless, as a quick fix, make the following changes: Change Line 31 from: (setq fmt "%lu6%qf1") ;; Field Formatting to: (setq fm1 "%lu6%qf1" ;; Field Formatting fm2 "%lu6%qf1" ) Change Lines 60-66 (inclusive) from: (setq str (strcat "%<\\AcObjProp Object(%<\\_ObjId " (LM:ObjectID (vlax-ename->vla-object (ssname sel 0))) ">%).Area \\f \"" fmt "\">%" ) ) to: (setq str (strcat "%<\\AcObjProp Object(%<\\_ObjId " (LM:ObjectID (vlax-ename->vla-object (ssname sel 0))) ">%).Area \\f \"" fm1 "\">%" " / " "%<\\AcObjProp Object(%<\\_ObjId " (LM:ObjectID (vlax-ename->vla-object (ssname sel 0))) ">%).Area \\f \"" fm2 "\">%" ) ) Change Lines 78-84 (inclusive) from: (setq str (strcat "%<\\AcExpr " (apply 'strcat (reverse (cdr (reverse lst)))) " \\f \"" fmt "\">%" ) ) to: (setq str (strcat "%<\\AcExpr " (apply 'strcat (reverse (cdr (reverse lst)))) " \\f \"" fm1 "\">%" " / " "%<\\AcExpr " (apply 'strcat (reverse (cdr (reverse lst)))) " \\f \"" fm2 "\">%" ) ) And populate the variables fm1 and fm2 with the formatting for the fields on each side of the forward slash. Quote Link to comment Share on other sites More sharing options...
Spirax Posted January 18, 2018 Author Share Posted January 18, 2018 Hi Lee, Thanks very much for that. I have made those adjustments however it's not working for me. I am not getting an error on load, it seems to work but is not output any text at all. It will realise I have selected an object then ask me where to place it, but shows up blank. I have uploaded a copy here, https://pastebin.com/fVv7phXS Could you please spot what I have done wrong? Appreciate your help! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 18, 2018 Share Posted January 18, 2018 I think you misunderstood my instruction: "And populate the variables fm1 and fm2 with the formatting for the fields on each side of the forward slash." You should only change the values of fm1 & fm2, not substitute values where I have used these variables. i.e. When I instructed: "And populate the variables fm1 and fm2 with the formatting for the fields on each side of the forward slash.", I meant that you should set this part: (setq fm1 "%lu6%qf1" ;; Field Formatting fm2 "%lu6%qf1" ) to your formatting of choice, e.g.: (setq fm1 "%lu2%pr2%ps[, ac]%ct8[0.0002471044]" ;; Field Formatting fm2 "%lu2%pr2%ps[, ha]%ct8[0.0001]" ) Sorry, I thought this was clear. Quote Link to comment Share on other sites More sharing options...
Spirax Posted January 18, 2018 Author Share Posted January 18, 2018 Surprise surprise I knew I would much it up. But it's very clear, changed it and works perfectly! Thank you so much. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 18, 2018 Share Posted January 18, 2018 Excellent - you're welcome. Quote Link to comment Share on other sites More sharing options...
Spirax Posted January 19, 2018 Author Share Posted January 19, 2018 Sorry one last question how can output this text as Arial Narrow with text height 2.5? Can it be done? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 19, 2018 Share Posted January 19, 2018 Sorry one last question how can output this text as Arial Narrow with text height 2.5?Can it be done? Configure your Text Style accordingly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.