You can preset the crosshair size by updating the "GUIDE_SIZE" constant. ![]() js(x) file (or clone it from the github repo), select the item(s) in your document for which you want to draw guides, then execute this script and it will create a 10x10pt crosshair in the center of each selected item. Using that, you can easily create a crosshair, and then align it to your selected object(s). (the alignment functions also have a dependency called "object_bounds_data.js" which can be found in the same public_illustrator_scripts repo). I've written a public community utility for aligning objects via script which you can find here: Safer to use the true visible bounds of the artwork itself as opposed to tying the guides to an artboard that may or may not be relevant. It will have long guidelines that extend way off the actual artwork until it reaches the edge of the artboard, since you're using the bounds of the active artboard to draw your pathpoints. So you can save yourself two selected items and one menuCommand by using this instead:Įdit** it also just occurred to me that your function here might produce undesired results if the selected artwork is not on the artboard. Simply set PathItem.guides = true, and you're good to go. the pathItem object has a "guides" property which is a boolean that determines whether it's a guide or not. In fact, i recommend against it because it creates an unnecessary undo step which makes it trickier to revert changes made by the script. Lastly, you needn't use executeMenuCommand for making guides. ![]() then simply extract the centerpoint from the artboardRect, then scrap the temporary artboard. And instead, we could create a temporary artboard and use executeMenuCommand to fit the temp artboard to the current art. One could forget all about the geometric bounds of the artwork itself, since that property can't be fully trusted. But reading through your code gives me another idea of how to tackle the problem without the added dependencies that my script requires. I utilized getVisibleBounds() function for my stab at this. My only beef is the ever present issue in visible/geometricBounds and clip masks.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |