Replace Closed Curves With Circle  1-20  21

Next
 From:  Mindset (IGNITER)
8080.1 
Hello to All,

I am attempting to create a script to cleanup a vector trace of a half-tone image out of AI.
The goal is to loop through the closed curves and replace them with actual circles.
My attempt fails because all the new curves are getting created at the 0,0,0 origin rather than at the BoundingBoxCenter of the object to be replaced.
Also, how would one test if the object to be replaced is indeed a close curve and not already a circle?

Any help will be appreciated; this is my first attempt at scripting.
The is best forum in the world.

Thanks to everyone.
-- Mindset

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Karsten (KMRQUS)
8080.2 In reply to 8080.1 
Hello Mindset,

the problem is caused by a little mistake in the circle-factories input. Index 1 needs a coordinateframe that defines the position and orientation in space. Index 2 you won't need (Point on the radius - not the center!!!) its alternative to Index 3 -> the radius (mode set in Index 0). You've evaluate the coordinateframe from the view, but You have to create a individual coordinateframe for every circle. Something like this
var circcenter=moi.vectorMath.createFrame(center,plane.xaxis,plane.yaxis);

Good luck!
Karsten

p.s.: dist/2 != radius

EDITED: 5 Sep 2016 by KMRQUS

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Karsten (KMRQUS)
8080.3 In reply to 8080.1 
Maybe like this:-)
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Mindset (IGNITER)
8080.4 
Wow THANKS Karsten!
Like I said: "Best forum in the World!"

I did not understand you explanation at all, but you script works... so I thank you!!
Very well appreciated.
-- Mindset
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Karsten (KMRQUS)
8080.5 In reply to 8080.4 
Gladly!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  futagoza (STEFAN)
8080.6 
Wow ,from me too! Thank you very much!

Regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Mindset (IGNITER)
8080.7 
I just want to reiterate my appreciation.
This is the best software experience I've ever known.
Thank you Karsten helping with this.

Indeed thanks to all the wonderful people who make this forum so Great!
Special gratitude to Michael Gibson for empowering and inspiring such a vibrant community.

-- Mindset
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
8080.8 In reply to 8080.7 
Thanks very much Mindset & Karsten too!

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
8080.9 
With what program is created the "half Tone" image of the first post ?
A free one ?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Message 8080.10 deleted 9 Sep 2016 by KMRQUS

Previous
Next
 From:  Mindset (IGNITER)
8080.11 In reply to 8080.9 
Frenchy,

The original attempt was via a Photoshop filter and traced to vector in Illustrator, but a better result was had from http://jasondorie.com/downloads/HalftonerV1.5.zip

The halftone Photoshop filter is of course raster based.
HalftonerV1.5 allows one to save in DXF, so the 'dots' are generated indeed as circles.

And YES, HalftonerV1.5 is free.

Hope this helps.

-- Mindset

PS, I thank you Frenchy Pilou for all your considerable contributions to this forum as well
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
8080.12 In reply to 8080.11 

EDITED: 9 Sep 2016 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
8080.13 
About the CCWC above. (who is yet very cool)
It's transform any form of closed curves!

Does it not possible to input a factor or something else
for transform only closed curves who are more near arbitrarily a circle than an another form ?
(here one is a "J", other a rectangle (rounded))

EDITED: 9 Sep 2016 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  OSTexo
8080.14 
Hello,

Have you checked out Astute Graphics Phantasm plugin?

http://astutegraphics.com/software/phantasm/
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
8080.15 In reply to 8080.13 
Hi Pilou, it's probably going to be difficult to make it behave like you're asking for there - computer programs generally can't just use human judgement to make decisions like that, they have to follow a detailed step-by-step algorithm.

If you can think of a more detailed set of rules that would result in the choices you show, then that could maybe be possible to translate into an algorithm.

But otherwise to just have it decide like a human would decide would need something like Artificial Intelligence to work.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Karsten (KMRQUS)
8080.16 In reply to 8080.13 
Hello Pilou,

I thought also about the problem and I agree with Michael. A simple, but very coarse filter would be to analyse boundingbox aspect ratio and the curve length in relationship to the absolute dimesions of the boundingbox.
And I have to note, the script CCWC isn't my project, it is an example to show the input parameters of the circle-factory in
Mindsets script! So I didn't tested it really.

Have a nice day
Karsten
p.s.: I have tried to implement gestures in MOIs scriptengine and it is a similar, but difficult problem.
http://moi3d.com/forum/index.php?webtag=MOI&msg=8078.6

EDITED: 10 Sep 2016 by KMRQUS

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Marius
8080.17 
Hello,
Does it possible to create a similar script that changes closed curves with circle to nearest integer value from the specific range? For example I type range from 2 to 6, curves closest to this values (from 1,51 to 6,50 in this case) are change with nearest integer value circle, assign any unique styles group by value and the rest outside the range are hide.
Sorry for my English, I hope it's understandable.
Thank you in advance for your help.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
8080.18 In reply to 8080.17 
Possible? I think Yes.
Augment the script with .htm file to select some or all closed curves,
and also to request the desired range of "dist" (dist = box.diagonalLength;), as distMin, and distMax.
distMin and distMax can be any value, not just integers.


Filter the selected closed curves with "dist", as follows:

If a closed curve's "dist" value is outside of the range, do not process that closed curve.

If a closed curve's "dist" value is inside the range, process that closed curve.
modify factory.setInput( 3, (Math.sqrt(dist*dist/2)/2));, by applying
Math.round(Math.sqrt(dist*dist/2)/2)),
or Math.ceil(), or Math.floor(),
to get the circle's radius in an integer value.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Marius
8080.19 In reply to 8080.18 
Heh :-). Thank you Brian. I'm not a programmer but I understand idea and I'll try translate your helpful hints into a complete script. Trial and error method :-).

Marius
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
8080.20 In reply to 8080.19 
Maybe combine and modify RCCWC.js, lineweb.js and lineweb.htm, and maybe some other script...

Looking forward to your new script.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-20  21